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!

Question regarding String objects and memory

807591May 2 2008 — edited May 4 2008
I have following two statements:

String str1 = new String("java");
String str2 = "java";

Now how many objects are created by each line and where?
Secondly, where is strings constant pool created? IN the heap itself??
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 1 2008
Added on May 2 2008
16 comments
450 views