Oracle
1Z0-851 · Question #24
Given: 01. interface Animal { void makeNoise(); } 02. class Horse implements Animal { 03. Long weight = 1200L; 04. public void makeNoise() { System.out.println("whinny"); } 05. } 06. 07. public…
The correct answer is E. 4. See the full explanation below for the reasoning.
Question
Given: 01. interface Animal { void makeNoise(); } 02. class Horse implements Animal { 03. Long weight = 1200L; 04. public void makeNoise() { System.out.println("whinny"); } 05. } 06. 07. public class Icelandic extends Horse { 08. public void makeNoise() { System.out.println("vinny"); } 09. public static void main(String[] args) { 10. Icelandic i1 = new Icelandic(); 11. Icelandic i2 = new Icelandic(); 12. Icelandic i3 = new Icelandic(); 13. i3 = i1; i1 = i2; i2 = null; i3 = i1; 14. } 15. } When line 15 is reached, how many objects are eligible for the garbage collector?
Options
- A0
- B1
- C2
- D3
- E4
- F6
How the community answered
(19 responses)- A11% (2)
- C5% (1)
- D5% (1)
- E79% (15)
Community Discussion
No community discussion yet for this question.