File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "String Objects" Watch "String Objects" New topic

String Objects

Shreya Raina

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

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

How many objects are created and how??

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46368
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.
I agree. Here's the link:
subject: String Objects
It's not a secret anymore!