0
Why is the second one false?
Code: Integer i1 = 127; Integer i2 = 127; System.out.println(i1==i2); //true i1 = 128; i2 = 128; System.out.println(i1==i2); //false? Please explain
4 odpowiedzi
0
InvBoy in your code you wrote of int instead of Integer. Correcting that and running the code will show the second one is false.
0
Gordie thank you for your answer. i do not understand the part about caching and how it makes i1 and i2 unequal. Can you please explain?
0
Gordie thanks you so much! your explanation was very clear and helpful.