nerdexam
Oracle

1Z0-851 · Question #158

Given: 09. class One { 10. void foo() { } 11. } 12. 13. class Two extends One { 14. //insert method here 15. } Which three methods, inserted individually at line 14, will correctly complete class…

The correct answer is B. void foo() { /* more code here */ } C. public void foo() { /* more code here */ } E. protected void foo() { /* more code here */ }. See the full explanation below for the reasoning.

Question

Given: 09. class One { 10. void foo() { } 11. } 12. 13. class Two extends One { 14. //insert method here 15. } Which three methods, inserted individually at line 14, will correctly complete class Two? (Choose three.)

Options

  • Aint foo() { /* more code here */ }
  • Bvoid foo() { /* more code here */ }
  • Cpublic void foo() { /* more code here */ }
  • Dprivate void foo() { /* more code here */ }
  • Eprotected void foo() { /* more code here */ }

How the community answered

(16 responses)
  • A
    19% (3)
  • B
    75% (12)
  • D
    6% (1)

Community Discussion

No community discussion yet for this question.

Full 1Z0-851 Practice