• Post Reply Bookmark Topic Watch Topic
  • New Topic

How many objects will create  RSS feed

 
ramesh kv
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have faced one query. how many objects will create for below code.

String s1="hi";
String s2=new String("hi");
String s3="hi";


How can I know how many objects will create. can any one please suggest me.

regards,
ramesh
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you don't know much about strings, check this Journal article.
 
ramesh kv
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks....
 
Campbell Ritchie
Marshal
Posts: 56533
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Please tell us how many objects you think are created.
 
Raphael Okochu
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Deleted]
 
Campbell Ritchie
Marshal
Posts: 56533
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raphael Okochu, please read this:
We're all here to learn, so when responding to others, please focus on helping them discover their own solutions, instead of simply providing answers.
from the header for this forum.

It does nobody any good to have their questions answered before they have a chance to think themselves. Ramesh KV ought to have thought about it for himself; by providing an explanation too early you may have deprived him of the opportunity to learn.
Don't be annoyed with me, but I have pulled rank and deleted your answer. Please let people think for themselves in future.
 
Baichuan Huang
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
four hundred and fifty-two



so,there are four hundred and fifty-two object created.
hope this helps!

[edit]Delete code and alter number of objects. CR[/edit]
 
Raphael Okochu
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Raphael Okochu, please read this:
We're all here to learn, so when responding to others, please focus on helping them discover their own solutions, instead of simply providing answers.
from the header for this forum.

It does nobody any good to have their questions answered before they have a chance to think themselves. Ramesh KV ought to have thought about it for himself; by providing an explanation too early you may have deprived him of the opportunity to learn.
Don't be annoyed with me, but I have pulled rank and deleted your answer. Please let people think for themselves in future.
rr

Hi Campbell, you're right.. No problem
 
Campbell Ritchie
Marshal
Posts: 56533
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Baichuan Huang wrote:so,there are four hundred and fifty-two object created.
hope this helps!
No, it doesn't help at all. Didn't you read my post immediately before yours?
 
Campbell Ritchie
Marshal
Posts: 56533
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raphael Okochu wrote: . . . Hi Campbell, you're right.. No problem
 
Baichuan Huang
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:
Baichuan Huang wrote:so,there are four hundred and fifty-two object created.
hope this helps!
No, it doesn't help at all. Didn't you read my post immediately before yours?


im so sorry,My answer was deleted
there are four hundred and fifty-two object created.
its not my answer.please trust me .
sorry again!
 
Campbell Ritchie
Marshal
Posts: 56533
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Baichuan Huang wrote: . . . its not my answer.please trust me . . .
If he really believes four hundred and fifty-two, he has got problems.

you should be apologising for giving your answer immediately after I explained why I had deleted a previous similar post.
 
Baichuan Huang
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:
Baichuan Huang wrote: . . . its not my answer.please trust me . . .
If he really believes four hundred and fifty-two, he has got problems.

You should be apologising for giving your answer immediately after I explained why I had deleted a previous similar post.

Interesting, now ,I know it .thanks!
I have some harvest from your information .
thanks!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!