Created
September 30, 2016 16:57
-
-
Save lawesson/3e060879acb67f792ba309c3b12927ae to your computer and use it in GitHub Desktop.
Testing the java.lang.Integer.IntegerCache
This file contains 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 IntegerCacheTest { | |
private static void test(Integer i, Integer i2) { | |
System.out.println(i); | |
if (i == i2) System.out.println(" the same"); | |
if (i != i2) System.out.println(" different"); | |
if (i.equals(i2)) System.out.println(" equal"); | |
} | |
public static void main(String[] args) { | |
test(17, 17); | |
test(200, 200); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment