exam questions

Exam 1z0-819 All Questions

View all questions & answers for the 1z0-819 exam

Exam 1z0-819 topic 1 question 96 discussion

Actual exam question from Oracle's 1z0-819
Question #: 96
Topic #: 1
[All 1z0-819 Questions]

Given:



and



and



What code inserted into class C would allow it to compile?

  • A. public void x() { }
    public void z() { }
  • B. public void x() { }
    protected void y() { super.y(); }
    public void z() { }
  • C. void x() { }
    public void y() { }
    public void z() { }
  • D. void x() { super.y(); }
    public void z() { }
  • E. void x() { }
    public void z() { }
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
ASPushkin
7 months, 2 weeks ago
Selected Answer: A
answer: A B Failed default method y() is a public so it can not has a weaker access privileges with the inheritance --------- CDE FAILED interface method x() is a public it can not has a weaker access privileges with the inheritance
upvoted 1 times
...
Omnisumem
8 months ago
Selected Answer: A
tested, A
upvoted 1 times
...
mendjijet
12 months ago
Selected Answer: A
Correct is A
upvoted 1 times
...
d7bb0b2
1 year ago
A =>is correct , B=> Cannot user super.y() to call interface method , this is only used to call superclass methods not interface method, so if you call default method of interface directly use y(); C=> void x() is less restrictive that method in interface, the interface methhos is marked as public abstract. D=> SAME REASON B + C E=> SAMME REASON C
upvoted 1 times
...
Stavok
1 year, 6 months ago
Selected Answer: A
A is correct
upvoted 2 times
...
Jtic
1 year, 11 months ago
Selected Answer: C
@Override public void x() { } @Override public void y() { A.super.y(); } @Override public void z() { }
upvoted 1 times
Jtic
1 year, 11 months ago
corrected=> A. public void x() { } public void z() { }
upvoted 2 times
...
[Removed]
1 year, 5 months ago
C Will not work as the answer C states: void x(){} which is package private. And an overriding method needs wider or the same access modifiers.
upvoted 1 times
d7bb0b2
1 year ago
That is correct, interface by default is marked as public abstract , so implement acces less restrictive not compile.
upvoted 1 times
...
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago