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!

String Pool

J2EE_LifeJan 5 2012 — edited Jan 9 2012
HI All,

When following assingments are done, then why two objects are created. According to string pool, only distinct objects exists for string in JVM. So == operator should return true. Till I was unaware of String Pool, it appeared right. But now I am a bit confused.

String s1="ab";
String s2="ab";

Kindly guide me on this. And point me to some good links about JVM, classloaders and String Pool. In books i am not able to find good coverage on these topics.
This post has been answered by unknown-7404 on Jan 5 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 6 2012
Added on Jan 5 2012
9 comments
575 views