|
explain
Integer x=new Integer(5);
x is a instance of class Integer.
Integer y;
y is another instance of class Integer.
when y=x; you assign x to y . y's value is x or y has a handle to reference x. now x is still a instance of Integer and has value 5.
you used System.out.print(x); output still 5. |
|