Will the String literal be garbage Collected?
- String str="ansh";
- str=null;
- //More code here
If no reference of String str is there after line 2, will this string become eligible for garbage collection or will it remains in String pool during the entire execution?