Oracle 1Z0-808 Exam question no. 14

Q. – Given the code fragments:-

class Student { 
         String name;
         int age;
}

 And: 

4. public class Test  {  
5.         public static void main(String[] args) { 
6.                    Student s1 = new Student (); 
7.                    Student s2 = new Student (); 
8.                    Student s3 = new Student (); 
9.                    s1 = s3; 
10.                  s3 = s2; 
11.                  s1 = s2 
12.      } 
13. } 

Which statement is true? 

A) After line 11, three objects are eligible for garbage collection. 

B) After line 11, two objects are eligible for garbage collection. 

C) After line 11, none of the objects are eligible for garbage collection. 

D) After line 11, one object is eligible for garbage collection.


⧪ please give your answer in a comment section.

Post a Comment

3 Comments