Regards,<P>Raj.<BR>-------------------------<BR>Afforts should be Appriciated.<BR>-------------------------
Originally posted by Rajpal Kandhari:
Hello Ajith & Eveyone out here:
If code is like below,
String str="First";
str="Second";
str="Third";
str="Four";
Then after line 4, 3 objects will be eligible for Garbage Collection.
Should we conside this as the bottom line:
"How the string object is created (with new or without new) has no effect on Object eligible for GC."
Pls help us out.
Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
Originally posted by Sujit Kurtadikar:
Thanks for clarification. But I want to verify this.
How to find the address of Object. Whether hashCode() gives address of Object?
String s1 = "Hello";
s1 = "World";
s1 = "Hello";
as you said, String objects are not eligible for GC, then address of Object refered by s1 and s3 must be same.
Can anybody tell how to verify this ?
sujit
Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |