CSC300 / CSC402: Integers Close to Zero [16/24] Previous pageContentsNext page

Integer x = 30;
Integer y = 30;
x=30, y=30
                  x==y : true
   Objects.equals(x,y) : true
           x.equals(y) : true
eqi08

This is like what Java does with string interning -- boxed integers close to 0 are given a canonical representation.

Again, this is for efficiency.

Previous pageContentsNext page