hehhehehehheeheheheheheheheheheh, calm down, calm down. those stuff are for sales
【在 g***y 的大作中提到】 : 这是什么,创意设计? : 让我也去跟着做这个?
e*3
11 楼
Java一直都是pass by value的,只不过object的value是reference罢了。
【在 g*****g 的大作中提到】 : It's always pass by reference for object and pass by value : for primitive. Array is an object and values in object can : be changed.
wh
12 楼
继续读学位吧?有个志同道合的圈子,继续深造,做自己喜欢做的事。
【在 g***y 的大作中提到】 : 这是什么,创意设计? : 让我也去跟着做这个?
x*p
13 楼
Java is always pass by references. For primitive types, in Java 5, it is considered as a object by autoboxing. Thus it is still pass by references. The reason why the value of a primitive can not be changed outside the function is because that the corresponding object of the primitive is immutable. Look at the following two examples. 1. void foo(String str) { str = "inFoo"; } String s = "abc"; foo(s); System.out.println(s); The output is abc, not inFoo. String is an object, but it is immutable. so its value can not be changed and thus looks like pass by value. 2. class A { int x = 10; } void foo(A a) { a.x = 20; } A a = new A(); foo(a); System.out.println(a.x); The output is 20, not 10. It is pass by references and the value is changed after the function call.
g*y
14 楼
我随口问的,没激动。。。。不好意思,就是开头不理解你什么意思。。。呵呵
for
【在 O*******o 的大作中提到】 : hehhehehehheeheheheheheheheheheh, calm down, calm down. those stuff are for : sales
【在 x*****p 的大作中提到】 : Java is always pass by references. For primitive types, in Java 5, it is : considered as a object by autoboxing. Thus it is still pass by references. : The reason why the value of a primitive can not be changed outside the : function is because that the corresponding object of the primitive is : immutable. : Look at the following two examples. : 1. void foo(String str) { str = "inFoo"; } : String s = "abc"; : foo(s); : System.out.println(s);
g*y
16 楼
恩,是啊,还是读书好一些也简单一点。。。
【在 wh 的大作中提到】 : 继续读学位吧?有个志同道合的圈子,继续深造,做自己喜欢做的事。
g*e
17 楼
java is pass by value
【在 x*****p 的大作中提到】 : Java is always pass by references. For primitive types, in Java 5, it is : considered as a object by autoboxing. Thus it is still pass by references. : The reason why the value of a primitive can not be changed outside the : function is because that the corresponding object of the primitive is : immutable. : Look at the following two examples. : 1. void foo(String str) { str = "inFoo"; } : String s = "abc"; : foo(s); : System.out.println(s);
我觉得, 其实大家都知道怎么回事。 混乱在于, 对pass by reference/pass by value的理解错误。 java is pass by value. pass by reference has a simple test: swap(YourType a, YourType b) { YourType temp; temp = a; a = b; b = temp; } 如果这个过了, 就是pass by reference。
【在 g**e 的大作中提到】 : java is pass by value
x*p
20 楼
In C/C++, value and reference has strict definition. Reference only means the address of an object and the value means the content of the object. However, Java messed up the two concepts. Lots of books say that Java is pass by value, and actually mean "pass by the value of the reference". So in Java, value and reference are the same thing. That is why it confused so many people and create a big fight among even top Java players in the world. In US industry, the answer is unique: Java is pass by reference.
g*e
21 楼
pass by the value of the reference 这句话靠谱 US哪个industry说java pass by reference的?
in world.
【在 x*****p 的大作中提到】 : In C/C++, value and reference has strict definition. Reference only means : the address of an object and the value means the content of the object. : However, Java messed up the two concepts. Lots of books say that Java is : pass by value, and actually mean "pass by the value of the reference". So in : Java, value and reference are the same thing. That is why it confused so : many people and create a big fight among even top Java players in the world. : In US industry, the answer is unique: Java is pass by reference.
e*g
22 楼
exactly, for primitive types(8 types, boolean, char, short, int, long, float , double) types pass by value for objects pass the reference of objects
【在 e********3 的大作中提到】 : Java一直都是pass by value的,只不过object的value是reference罢了。
美国工业界,都是回答Java is pass by reference,or the value of the reference 。
G*o
25 楼
support... pass by reference...
h*0
26 楼
这理解得完全莫名其妙……
【在 x*****p 的大作中提到】 : Java is always pass by references. For primitive types, in Java 5, it is : considered as a object by autoboxing. Thus it is still pass by references. : The reason why the value of a primitive can not be changed outside the : function is because that the corresponding object of the primitive is : immutable. : Look at the following two examples. : 1. void foo(String str) { str = "inFoo"; } : String s = "abc"; : foo(s); : System.out.println(s);
h*0
27 楼
对于对象,是这样的。对于int这种,你居然还敢说passed by reference,还找出一个 不靠谱的例子,说出"auto-boxing"这种跟本话题完全不相关的内容。
in world.
【在 x*****p 的大作中提到】 : In C/C++, value and reference has strict definition. Reference only means : the address of an object and the value means the content of the object. : However, Java messed up the two concepts. Lots of books say that Java is : pass by value, and actually mean "pass by the value of the reference". So in : Java, value and reference are the same thing. That is why it confused so : many people and create a big fight among even top Java players in the world. : In US industry, the answer is unique: Java is pass by reference.