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
Doubt from some book - How many String objects
Moderator: admin
-
- Posts: 17
- Joined: Fri Oct 11, 2013 10:31 am
- Contact:
Doubt from some book - How many String objects
Last edited by admin on Sat Aug 09, 2014 10:20 pm, edited 1 time in total.
Reason: Updated the subject
Reason: Updated the subject
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1303 :
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.
-Paul.
-
- Posts: 17
- Joined: Fri Oct 11, 2013 10:31 am
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1303 :
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
Is it possible for you to still provide some explanation ?
Thanks and once again sorry for the mistake
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1303 :
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.
The book probably costs more than our s/w. Didn't the author respond to your doubt?
-Paul.
Who is online
Users browsing this forum: No registered users and 8 guests