nerdexam
Oracle

1Z0-804 · Question #133

Given: What is the result?

The correct answer is E. The code fails to compile. protected String bark() public class Beagle extends Dog { private String bark() Cannot reduce the visibility of the inherited method from Dog

Java Class Design

Question

Given:

What is the result?

Options

  • Awoof arf
  • Bwoof woof
  • Carf arf
  • DA RuntimeException is generated
  • EThe code fails to compile

How the community answered

(25 responses)
  • B
    4% (1)
  • C
    8% (2)
  • D
    12% (3)
  • E
    76% (19)

Explanation

protected String bark() public class Beagle extends Dog { private String bark() Cannot reduce the visibility of the inherited method from Dog

Topics

#polymorphism#method overriding#compilation#virtual method

Community Discussion

No community discussion yet for this question.

Full 1Z0-804 Practice