In the following code, which is the earliest statement, where the object originally held in e, may be garbage collected:
public class
Test {
public static void main (
String args []) {
Employee e = new Employee("Bob", 48);
e.calculatePay();
System.out.println(e.printDetails());
e = null;
e = new Employee("Denise", 36);
e.calculatePay();
System.out.println(e.printDetails());
}
}
A.Line 10
B.Line 11
C.Line 7
D.Line 8
E.Never
Select the most appropriate answer.
The correct answer to this question is C which is line 7 but I thought it was line 6, because when you say e=null it is ready to be garbage collected???