...
Code Block |
---|
public class TestWrapper2 { Â public static void main(String[] args) { Â Â Â Â Integer i1 = 100; Â Â Â Â Integer i2 = 100; Â Â Â Â Integer i3 = 1000; Â Â Â Â Integer i4 = 1000; Â Â Â Â System.out.println(i1.equals(i2)); Â Â Â Â System.out.println(i3.equals(i4));Â Â Â Â Â } }Â |
Using object1.equals(object2) only compares their values. Now, the results will be true, as we expected.
...