Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java string : Interned

807589Nov 1 2008 — edited Nov 1 2008
Hello java guys,

i just wanted to know something about java string.

let me know

1 " HOW many OBJECT are created in *heap* "
String aa=new strirg("ABC");
String abc=new strirg("ABC");
String abcd=new strirg("ABC");
i guess only one

One object is created in Heap memory and
one pool (interned) is created.

so total is TWO.


2. " HOW many OBJECT are created in *heap* " in below situation

String am=new String("XX");
String a=new String("XX");
String abc="XX";
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 29 2008
Added on Nov 1 2008
6 comments
199 views