aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes How many string objects Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "How many string objects" Watch "How many string objects" New topic
Author

How many string objects

Sneha Kapoor
Ranch Hand

Joined: Jun 08, 2009
Posts: 49

Hi All,




As per understanding there are 3 objects 1)Fred 2)47 3)s.toString(); on line 16

am i right??
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3670

Please QuoteYourSources. Simple search for "fred 47" in the forum will give you the answer for this.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Sneha Kapoor
Ranch Hand

Joined: Jun 08, 2009
Posts: 49
Source: VoodooExam
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3670

Except toString() method all other operations will create a new object ( except s=s+"47" will make 2). For scjp level this is correct (as there are little more to this with regards to the String constants as they may have created already before the method invoked, at the class loading).
Ankit Garg
Saloon Keeper

Joined: Aug 03, 2008
Posts: 9189
    
    2

Look here

http://www.coderanch.com/t/434127/Programmer-Certification-SCJP/certification/many-String-Objects-are-created#1930019


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How many string objects
 
Similar Threads
String objects created
Mock Exam Ques-.No of String objectss creation
Question on String
How many string object created in this code
how many String objects created??