Given: 1. class A { 2. } 3. class Alpha { 4. private A myA = new A(); 5. 6. void dolt( A a ) { 7. a = null; 8. } 9. void tryIt() { 10. dolt( myA ); 11. } 12. } Which two statements are correct?

  1. Explicitly setting myA to null marks that instance to be eligible for garbage collection

  2. Private instances of A become eligible for garbage collection when instances of Alpha become eligible for garbage collection.

  3. Any call on tryIt() causes the private instance of A to be marked for garbage collection.

  4. There are no instanced of A that will become eligible for garbage collection.


Correct Option: A,B

Find more quizzes: