Might be silly question,
Need understanding on below
1.) // reference declared , null Object
String message = null;
in above case, when will the reference 'message' eligible for garbage collection, read somewhere if make string reference to null it becomes eligible for GC
2.) // reference declared , empty String Object
String message = "";
3.) // reference declared , Object with value Hello
String message = "Hello";
From above, 1 references is created in all the three cases,
What about the Object creation..?? How will they be maintained in String Pool and heap
""and"Hello"will be created asStringobjects, what do you want to know?Empty Stringalso an object, will null be referenced somewhere, or what happens to reference as soon as i declareString message = null;, is it eligible for gc."". "will null be referenced somewhere, or what happens to reference as soon as i declare String message = null; " - the pointer points tonull.objectin memory..??