锘??xml version="1.0" encoding="utf-8" standalone="yes"?>日韩欧美中文字幕公布,国产精品一区二区三区精品,国产欧美一区二区精品久久久http://www.aygfsteel.com/SummerTse/category/29305.html鍙璧拌繃鍘伙紝涓嶈閫楃暀錛屽洜涓轟竴璺笂錛岃姳鏈典細(xì)緇х畫寮鏀俱?/description>zh-cnWed, 30 Apr 2008 22:55:28 GMTWed, 30 Apr 2008 22:55:28 GMT60- 鍐嶆寮鴻皟Java鍙傛暟浼犻掔殑鏈哄埗http://www.aygfsteel.com/SummerTse/articles/197212.html,,銈塖ummer,,銈塖ummerTue, 29 Apr 2008 06:03:00 GMThttp://www.aygfsteel.com/SummerTse/articles/197212.htmlhttp://www.aygfsteel.com/SummerTse/comments/197212.htmlhttp://www.aygfsteel.com/SummerTse/articles/197212.html#Feedback0http://www.aygfsteel.com/SummerTse/comments/commentRss/197212.htmlhttp://www.aygfsteel.com/SummerTse/services/trackbacks/197212.html涔嬪墠鏈変竴孌墊椂闂翠竴鐩村Java鐨勪紶鍙傚艦寮忔嚨鎳墊噦鎳傜殑銆傛渶榪戠壒鎰忓張緲誨紑浜?jiǎn)Core Java涓涔︼紝瀵逛簬鍏朵腑鐨勭ず渚嬭褰曞湪姝わ紝浣滀負(fù)涓涓ソ鐨勬暀璁?br />
import java.util.Date;

public class ParamTest


{
public static void tripleValue(double value)

{
value = 3 * value;
System.out.println("End of method: value=" + value);
}
public static void swap(Employee a, Employee b)

{
Employee temp = a;
a = b;
b= temp;
System.out.println("End of method: a=" + a.getName());
System.out.println("End of method: b=" + b.getName());
}
public static void tripleSalary(Employee e)

{
e.raiseSalary(200);
System.out.println("End of method: salary=" + e.getSalary());
}
public static void main(String[] args)

{

/**//*
* Test 1: Method can't modify numeric parameters
*/
System.out.println("Testing tripleValue:");
double percent = 10;
System.out.println("Before: percent=" + percent);
tripleValue(percent);
System.out.println("After: percent=" + percent);

/**//*
* Test 2: Methods can change the state of object parameters
*/
System.out.println("\nTesting tripleSalary");
Employee harry = new Employee("Harry", 50000, new Date());
System.out.println("Before: salary=" + harry.getSalary());
tripleSalary(harry);
System.out.println("After: salary=" + harry.getSalary());

/**//*
* Test 3: Methods can't attach new objects to object parameters
*/
System.out.println("\nTesting swap");
Employee a = new Employee("Alice", 70000, new Date());
Employee b = new Employee("Bob", 60000, new Date());
System.out.println("Before: a=" + a.getName());
System.out.println("Before: b=" + b.getName());
swap(a, b);
System.out.println("After: a=" + a.getName());
System.out.println("After: b=" + b.getName());
}
}

紼嬪簭鎵撳嵃緇撴灉涓猴細(xì)
Testing tripleValue:
Before: percent=10.0
End of method: value=30.0
After: percent=10.0
Testing tripleSalary
Before: salary=50000.0
End of method: salary=150000.0
After: salary=150000.0
Testing swap
Before: a=Alice
Before: b=Bob
End of method: a=Bob
End of method: b=Alice
After: a=Alice
After: b=Bob
鏈鍚庯紝鎬葷粨涓涓嬶紝Java涓弬鏁頒紶閫掑叏閮ㄩ兘鏄間紶閫掞紒鐗㈣榪欏彞璇濓紝鍩烘湰綾誨瀷鏄間紶閫掞紝鏃犺濡備綍淇敼錛岄兘涓嶄細(xì)褰卞搷鍘熸潵鐨勫彉閲忋傚璞′紶閫掍篃鏄間紶閫掞紝浼犻掔殑鏄璞″紩鐢ㄧ殑鍊鹼紙榪欓噷鏈夌偣涓嶅ソ鐞嗚В錛夛紝絀剁珶浠涔堟槸瀵硅薄寮曠敤鐨勫鹼紵濡?Object obj; //obj = new Object;榪欓噷鐨刼bj灝辨槸瀵硅薄寮曠敤錛屽悗闈竴鍙ヨ瘽鎵撲笂浜?jiǎn)娉ㄩ噴锛寴q欓噷铏界劧obj騫舵病鏈夊垵濮嬪寲錛屼絾鏄紝瀹冭繕鏄湁鍊肩殑錛屽綋鎶妎bj浣滀負(fù)鍙傛暟浼犻掔殑鏃跺欙紝浼犻掔殑鏄痮bj鐨勫箋傚憙錛岀獊鐒跺彂鐜拌嚜宸辯殑瑙i噴鑳藉姏鐪熺殑鏄湁澶熸瑺緙虹殑…涓腑鎰忎箟榪樻槸鑷繁鍒嗚В鍚с?br />

]]>
主站蜘蛛池模板:
黔西县|
上蔡县|
寿宁县|
澄城县|
泰宁县|
阿拉善盟|
万载县|
河间市|
师宗县|
临湘市|
梅州市|
辉县市|
景洪市|
根河市|
孝昌县|
昆明市|
托克逊县|
丹阳市|
大安市|
舟山市|
永新县|
炎陵县|
康马县|
和政县|
都江堰市|
木里|
南木林县|
九江市|
黄陵县|
阿坝县|
长泰县|
齐齐哈尔市|
商洛市|
南城县|
南部县|
灵丘县|
耒阳市|
名山县|
禄丰县|
贞丰县|
万州区|