r/javahelp • u/[deleted] • Jun 12 '22
Homework Casting from int to Integer.
So i've been fiddling around with java, and encountered a problem, that I don't quite understand.
int a = 10;Integer bigA = a;Integer bigB = a;System.out.println(bigA == bigB);
This piece of code returns true, for every int below and including 127. Above that it returns false. How so?
17
Upvotes
-4
u/OffbeatDrizzle Jun 12 '22
Whilst this is true, it's not really relevant since it doesn't answer the question and OP marked it as homework