http://www.javaprepare.com/notes/classes.html see this site
last q says that
string literal is eligible for garbage collection
public class GCTest {
public static void main(String args[]) {
String a,b;
String c = "test";
a = c;
c = null; // The String "test" is not yet
//available for GC as a still points to "test"
b = new String("xyz");
b = c; // String "xyz" is now available for GC.
a = null; //String "test" is now available for GC.
}
}
a = null; //String "test" is now available for GC. I think string literal are not garbage collected