nerdexam
Oracle

1Z0-815 · Question #60

Given: It is required that if p instanceof Pair then p.isValid() returns true. Which is the smallest set of visibility changes to insure this requirement is met?

The correct answer is B. left and right must be private. See the full explanation below for the reasoning.

Question

Given:

It is required that if p instanceof Pair then p.isValid() returns true. Which is the smallest set of visibility changes to insure this requirement is met?

Exhibit

1Z0-815 question #60 exhibit

Options

  • AsetLeft and setRight must be protected.
  • Bleft and right must be private.
  • CisValid must be public.
  • Dleft, right, setLeft, and setRight must be private.

How the community answered

(35 responses)
  • A
    6% (2)
  • B
    77% (27)
  • C
    14% (5)
  • D
    3% (1)

Community Discussion

No community discussion yet for this question.

Full 1Z0-815 Practice