jQuery in Action, 3rd edition
The moose likes Ranch Office and the fly likes How many String objects are created in the code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Ranch Office
Reply locked New topic

How many String objects are created in the code

Loveleen Saroya
Ranch Hand

Joined: Aug 08, 2005
Posts: 42
How many string objects are created in the following code:-

im confuse that in System.out.println statement 2 objects r created or 1.
one more doubt.. if we put the code in the main method of a class will the object created be increase by 1 as the main method takes array of string as parameter.so the empty string.

thanks in advance
SCJP 1.4 in progress
Michael Ernest
High Plains Drifter

Joined: Oct 25, 2000
Posts: 7292

Hi Loveleen -

It appears you have posted this same question three times in two separate forums. We refer to this practice as 'cross-posting' and we discourage it on JavaRanch.

Please use one forum for a question. Do the best job you can to pick the proper one; if it can be better located a bartender or sheriff will assist.



Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
I agree. Here's the link: http://aspose.com/file-tools
subject: How many String objects are created in the code
It's not a secret anymore!