About Question enthuware.ocajp.i.v7.2.1159 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
thupten
Posts: 4
Joined: Thu Jan 09, 2014 3:21 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1159 :

Post by thupten »

Has this question ever appeared on the test?
I think most would choose the Overflow exception as the answer. This is totally unexpected behavior. There probably are many programs out there with bug related to this. :(

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1159 :

Post by admin »

As mentioned in previous posts, this much detail about 1s and 2s complement is not required for the exam.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

Sergey
Posts: 39
Joined: Sat Jul 29, 2017 1:04 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1159 :

Post by Sergey »

I did not understand the explanation in programm, but i find this in the web:

Code: Select all

Basically, because Integer.MAX_VALUE is actually only 2147483647, so -Integer.MIN_VALUE, which would be +2147483648, actually overflows the capacity of the internal binary representation of integers. Thus, the result "loops around" back to Integer.MIN_VALUE, or -2147483648.
is it correct?

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1159 :

Post by admin »

Yes, the explanation explains the reason why "loop around" happens.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 40 guests