Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes String initialization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "String initialization" Watch "String initialization" New topic
Author

String initialization

Satish Kota
Ranch Hand

Joined: Feb 08, 2006
Posts: 88
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


SCJP 5.0 77%
Sanjeev Singh
Ranch Hand

Joined: Nov 01, 2006
Posts: 381
I don't think any method is called it all depends on underlying JVM implementations.(esp String pool).


~Sanjeev Singh<br />SCJP 1.5
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: String initialization
 
Similar Threads
any one tell me?
public static void main method
putting a name in an array
equal/== help
how to convert Byte to the String