Skip to content

Instantly share code, notes, and snippets.

@gitjs77
Created August 14, 2017 14:29
Show Gist options
  • Save gitjs77/9343df5255024013e8702a1176cdcced to your computer and use it in GitHub Desktop.
Save gitjs77/9343df5255024013e8702a1176cdcced to your computer and use it in GitHub Desktop.
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