wood burning stoves 2.0*
The moose likes Beginning Java 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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "String Objects" Watch "String Objects" New topic
Author

String Objects

Shreya Raina
Greenhorn

Joined: Sep 17, 2011
Posts: 1
hello Everyone!!

Please answer this for mee..
If
String s1="abc"
and
String s2=s1+ "def"

How many objects are created and how??

Thanks!!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37953
    
  22
Welcome to the Ranch.
You need three objects: a pencil, an eraser (probably the most important ) and a sheet of paper. You write down a short description of each object, whether it is created at runtime or when the class is loaded, and then you count them.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: String Objects
 
Similar Threads
How many objects are created ?
how many objects will create
Immutability of strings???
How many Objects are garbage collected?
String objects