Doubt from some book - How many String objects

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

Moderator: admin

Post Reply
hamada.yamasaki
Posts: 17
Joined: Fri Oct 11, 2013 10:31 am
Contact:

Doubt from some book - How many String objects

Post by hamada.yamasaki »

Hi,
I got little confused after this question. If i apply the knowledge gain from this question, then there must be 9 String object created but the author mentioned 8
String s1 = "spring ";
String s2 = s1 + "summer ";
s1.concat("fall ");
s2.concat(s1);
s1 += "winter ";
System.out.println((s1 + " " + s2));
Here are the instance which i thought:
spring
summer
spring summer
fall
spring fall
spring summer spring
winter
spring winter
spring winter spring summer // the author is not taking this instance into account

Could you please explain. Thanks a lot
Last edited by admin on Sat Aug 09, 2014 10:20 pm, edited 1 time in total.
Reason: Updated the subject

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

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

Post by admin »

Hamada, I couldn't find this question in our question bank. Are you sure you saw it in our question bank? I checked question 2.1303 and it is very different from what you've quoted.
-Paul.

hamada.yamasaki
Posts: 17
Joined: Fri Oct 11, 2013 10:31 am
Contact:

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

Post by hamada.yamasaki »

i am sorry i didn't noticed that it was mentioned in the book not in enthuware.
Is it possible for you to still provide some explanation ?
Thanks and once again sorry for the mistake

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

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

Post by admin »

Yes, 9 seems right. Not sure why the author says 8.
The book probably costs more than our s/w. Didn't the author respond to your doubt?
-Paul.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests