Nice addition to the explanation is that this is only the case with the minimum and maximum allowed int value.
In this code snippet:
a = Integer.MIN_VALUE + 1;
b = -a;
System.out.println( a+ " "+b);
it will print:
-2147483647 2147483647
About Question com.enthuware.ets.scjp.v6.2.511 :
Moderator: admin
-
- Posts: 50
- Joined: Sun Nov 10, 2013 4:39 am
- Contact:
-
- Site Admin
- Posts: 10398
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.511 :
No, it will not happen with MAX_VALUE.
Who is online
Users browsing this forum: No registered users and 7 guests