Skip to content

Instantly share code, notes, and snippets.

@up1
Last active November 23, 2015 14:30
Show Gist options
  • Save up1/1b8b815ea6b3711e34b8 to your computer and use it in GitHub Desktop.
Save up1/1b8b815ea6b3711e34b8 to your computer and use it in GitHub Desktop.
Java :: Pzzle
import static java.lang.System.out;
public class Aha {
public static void main(String ... args) {
Integer a = 1000, b = 1000;
out.println(a == b);
Integer c = 100, d = 100;
out.println(c == d);
}
}
public static Integer valueOf(int i) {
assert IntegerCache.high >= 127;
if (i >= IntegerCache.low && i <= IntegerCache.high)
return IntegerCache.cache[i + (-IntegerCache.low)];
return new Integer(i);
}
private static class IntegerCache {
static final int low = -128;
static final int high;
static final Integer cache[];
static {
// high value may be configured by property
int h = 127;
...
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment