What is meant by String ConstantPoll?
>> Monday, May 30, 2011
ConstantPoll:When we created a String Object with Assignment operator i.e String s="bhaskar" ;
The String object is stored in Constant Poll not in heap area.If the object is available in Constant poll it Just take the Reference of the Object Not creating another .that means If we are creating String s1="bhaskar" first JVM checks the object is available in ConstantPoll are not.If it is not available it creates a new object in Constant poll;.If available it just take it reference.
Example:
String s="Veeru";
String s1="Bhaskar";
String s2="bhaskar";
Here totally two objects are created.
The String object is stored in Constant Poll not in heap area.If the object is available in Constant poll it Just take the Reference of the Object Not creating another .that means If we are creating String s1="bhaskar" first JVM checks the object is available in ConstantPoll are not.If it is not available it creates a new object in Constant poll;.If available it just take it reference.
Example:
String s="Veeru";
String s1="Bhaskar";
String s2="bhaskar";
Here totally two objects are created.
0 comments:
Post a Comment