CSC300 / CSC402: Copying a Reference [20/24] |
Integer x = 3000; Integer y = x; x==y : true Objects.equals(x,y) : true x.equals(y) : true |
y
is now an alias for the object x
was pointing to at the time the assignment x = y
was performed.
Note: If you do an assignment, such as x = null
after that, y
would still point to the boxed integer with the value of 3000
!