top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

Will the String literal be garbage Collected in Java?

0 votes
64 views

Will the String literal be garbage Collected?

  1. String str="ansh";
  2. str=null;
  3. //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?

posted Sep 7, 2015 by Anamika

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...