Sail E0 Webinar
Question
How many objects will be eligible for garbage collection after line 7?
public class TutorialGC
{
public static void main(String [] args)
{
Object a = new Integer(100); // Line1
Object b = new Long(100); // Line2
Object c = new String(\"100\"); // Line3
a = null; // Line4
a = c; // Line5
c = b; // Line6
b = a; // Line7
// Rest of the code here
}
}
Options:
A .  0
B .  1
C .  2
D .  3
Answer: Option B





Submit Your Solution Below and Earn Points !
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers