Created
August 14, 2017 14:29
-
-
Save gitjs77/9343df5255024013e8702a1176cdcced to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class IntegerPool { | |
public static void main(String[] args) { | |
Integer i1 = 10; | |
Integer i2 = 10; | |
System.out.println(i1 == i2);// true, value < 128 | |
System.out.println("======================"); | |
Integer i3 = 300; | |
Integer i4 = 300; | |
System.out.println(i3 == i4); // false, value >= 128 | |
System.out.println("======================"); | |
Integer i5 = 128; | |
Integer i6 = 128; | |
System.out.println(i3 == i4); // false, value >= 128 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment