About Question com.enthuware.ets.scjp.v6.2.32

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

Moderator: admin

Post Reply
sarmadys
Posts: 4
Joined: Thu Jul 10, 2014 12:03 am
Contact:

About Question com.enthuware.ets.scjp.v6.2.32

Post by sarmadys »

Hello,

- Clicking on discussion of this question will bring you to question 235 instead.
- I still do not understand the answer. I don't see where the new integer is assigned (and where the value 6 was given to it).
However, x, which was pointing to the same object as dataWrapper, is assigned a new Integer object (different from dataWrapper) containing 6.
Regards

P.S. I am adding a snapshot (in case the q# is wrong). Please remove it if it is not fine.
Attachments
q32.JPG
q32.JPG (86.17 KiB) Viewed 3269 times

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

Re: About Question com.enthuware.ets.scjp.v6.2.32

Post by admin »

It is assigned at x++.

sarmadys
Posts: 4
Joined: Thu Jul 10, 2014 12:03 am
Contact:

Re: About Question com.enthuware.ets.scjp.v6.2.32

Post by sarmadys »

aah, the initial x is immutable but since the command is equal to

x = x + 1;

in fact a new immutable Integer object is created (with a value of 6) and assigned to the reference x.

Thank you.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 10 guests