aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes String objects.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "String objects.." Watch "String objects.." New topic
Author

String objects..

ramani2020
Greenhorn

Joined: Sep 14, 2000
Posts: 28
Hi..
pl help me with the foll qn.
How many String literals are created when the foll code is executed and run?
String s1, s2,s3,s4 ;
s1 = "hello";
s2 = s1;
s3 = s2+"pal";
s4 = s3;
A. 1
B. 2
C. 3
D. 4
E. Can't say
IMO since only s1 and s3 are created,and the rest are assigned, the answer is B. Am I right?
please help me..
thanks,
Ramani.
srikrish
Ranch Hand

Joined: Sep 12, 2000
Posts: 63
"pal" is also a literal that gets created in addition to s1 and s3.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: String objects..
 
Similar Threads
Doubt in Strings
String object
string question
String object
How many String object created?