CSC300 / CSC402: Integer Constructor (Deprecated) [19/24] Previous pageContentsNext page

Integer x = new Integer(30);
Integer y = new Integer(30);
x=30, y=30
                  x==y : false
   Objects.equals(x,y) : true
           x.equals(y) : true
eqi07

Again, the new operator in Java guarantees the construction of a new object.

Previous pageContentsNext page