Mam pytanie.java Integer reference
public class Jaba {
public static void main(String args[]) {
Integer i = new Integer(0);
new A(i);
System.out.println(i);
new B(i);
System.out.println(i);
int ii = 0;
new A(ii);
System.out.println(ii);
new B(ii);
System.out.println(ii);
}
}
class A {
public A(Integer i) { ++i; }
}
class B {
public B(int i) { ++i; }
}
Moim zdaniem przechodzącą int \ Integer As Integer do funkcji i podejmowania ++ tego odniesienia powinien zmienić podstawowy cel, ale wyjście jest 0 we wszystkich przypadkach. Dlaczego?
ahahahahahah ahahahahahaha ahahahahahahahahahahah XD – user3063349
tylko java wywołuje przez udostępnianie – user3063349