• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String initialization

 
Satish Kota
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which method of String class is called when a String object is being initialised or assigned. This is what i meant:

String s= "abc";

Which method of String class gets invoked to check for for existing value in string pool during this assignment process
 
Sanjeev Singh
Ranch Hand
Posts: 381
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think any method is called it all depends on underlying JVM implementations.(esp String pool).
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is largely an implementation detail. It's clearly not the single argument contructor that assigns a unique memory space.

I chalk it up to Java vodoo, but who knows.

-Cameron McKenzie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic