Oracle
1Z0-851 · Question #40
Given: 01. public class Hi { 02. void m1() { } 03. protected void() m2 { } 04. } 05. 06. class Lois extends Hi { 07. // insert code here 08. } Which four code fragments, inserted independently at…
The correct answer is A. public void m1() { } B. protected void m1() { } E. public void m2() { } F. protected void m2() { }. See the full explanation below for the reasoning.
Question
Given: 01. public class Hi { 02. void m1() { } 03. protected void() m2 { } 04. } 05. 06. class Lois extends Hi { 07. // insert code here 08. } Which four code fragments, inserted independently at line 7, will compile? (Choose four.)
Options
- Apublic void m1() { }
- Bprotected void m1() { }
- Cprivate void m1() { }
- Dvoid m2() { }
- Epublic void m2() { }
- Fprotected void m2() { }
- Gprivate void m2() { }
How the community answered
(32 responses)- A72% (23)
- C9% (3)
- D3% (1)
- G16% (5)
Community Discussion
No community discussion yet for this question.