• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Another String object confusion

 
Fran Kindred
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String a = "test";
a = null;
String b = "test";

Line 1 creates a new string instance and then places it in the String pool. Is that correct?

Also does Line 3 recreate a new object or does it use the object that was placed in the String pool. I'm confused about the relation between the String pool and the heap.

Thanks
[ November 04, 2004: Message edited by: Francis Palattao ]
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try reading this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic