I am a newbee in Java and stumbled upon a such question:
What happens if a variable is Integer.MAX_VALUE
?
System.out.println(2 * a);
System.out.println(4 * a);
Both give -2
and -4
results accordingly. Can someone explain me why this is it? I read about primitive int
type overloading but still don't understand why I got these results?