nerdexam
Oracle

1Z0-851 · Question #231

Given: class One { public One foo() { return this; } } class Two extends One { public One foo() { return this; } } class Three extends Two { // insert method here } Which two methods, inserted…

The correct answer is C. public Two foo() { return this; } D. public One foo() { return this; }. See the full explanation below for the reasoning.

Question

Given: class One { public One foo() { return this; } } class Two extends One { public One foo() { return this; } } class Three extends Two { // insert method here } Which two methods, inserted individually, correctly complete the Three class? (Choose two.)

Options

  • Apublic void foo() {}
  • Bpublic int foo() { return 3; }
  • Cpublic Two foo() { return this; }
  • Dpublic One foo() { return this; }
  • Epublic Object foo() { return this; }

How the community answered

(30 responses)
  • A
    3% (1)
  • B
    7% (2)
  • C
    77% (23)
  • E
    13% (4)

Community Discussion

No community discussion yet for this question.

Full 1Z0-851 Practice