Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Subtraction of a positive integer of a negative integer results a positive?

989832Feb 7 2013 — edited Feb 8 2013
Hi

I have the next problem and I haven't found the reason...
I have the next Java code:

int a = -2147483648;
int b = 2147483647;

System.out.println(a - b);

The output of this lines is "1", but I don't understand why.

Thanks
This post has been answered by unknown-7404 on Feb 7 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 8 2013
Added on Feb 7 2013
4 comments
2,016 views