Saturday, 25 May 2013

Exception - 10 -

From the following code how many objects are eligible for garbage collection?  

package net.dharmaraj;

public class dev
{
    public static void main(String a[])
    {
        String string1 = "Test";
        String string2 = "Today";
        string1 = null;
        string1 = string2;
    }
}



String string1 = "Test";  
String string2 = "Today";  
string1 = null;  
string1 = string2;  
A) 1  
B) 2  
C) 3  
D) 0  




No comments:

Post a Comment