File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Certification Results and the fly likes Garbage collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Certification » Certification Results
Bookmark "Garbage collection" Watch "Garbage collection" New topic

Garbage collection

george tharakan

Joined: Jan 12, 2001
Posts: 7
what is the earliest line in the following code after which object b
will be a candidate for being garbage collected.
public class test{
Static string f()
String s="hello";
String b="bye"; //1
String c=b+"i";
String d=b;
b=a; //2
d=a; //3
return c; //4
public static void main(String s[])
{String msg=f();
System.out.println(msg); // 5
can any one tell the answer with explanation
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Hi George,
Moving this to the Certification Study group as it's not related to results.


Jane Griscti
Sun Certified Java 2 Programmer
"When ideas fail, words come in very handy" -- Goethe

Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
I agree. Here's the link:
subject: Garbage collection
It's not a secret anymore!