자격증/OCJP_ExamC

QUESTION 38

IT grow. 2018. 7. 25. 01:12
반응형
QUESTION 38
Given:
interface Animal {
void makeNoise();
}
class Horse implements Animal {
Long weight = 1200L;
public void makeNoise() {
System.out.println("whinny");
}
}
01. public class Icelandic extends Horse {
02. public void makeNoise() {
03. System.out.println("vinny");
04. }
05.
06. public static void main(String[] args) {
07. Icelandic i1 = new Icelandic();
08. Icelandic i2 = new Icelandic();
09. Icelandic i3 = new Icelandic();
10. i3 = i1;
11. i1 = i2;
12. i2 = null;
13. i3 = i1;
14. }
15. }
When line 14 is reached, how many objects are eligible for the garbage collector?
A. 0
B. 1
C. 2
D. 3
E. 4
F. 6
Solution : E


반응형