exam questions

Exam 1z0-809 All Questions

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

Exam 1z0-809 topic 1 question 17 discussion

Actual exam question from Oracle's 1z0-809
Question #: 23
Topic #: 2
[All 1z0-809 Questions]

Given:
public final class IceCream {
public void prepare() {}
}
public class Cake {
public final void bake(int min, int temp) {}
public void mix() {}
}
public class Shop {
private Cake c = new Cake ();
private final double discount = 0.25;
public void makeReady () { c.bake(10, 120); }
}
public class Bread extends Cake {
public void bake(int minutes, int temperature) {}
public void addToppings() {}
}
Which statement is true?
IceCream.

  • A. A compilation error occurs in Cake.
  • B. A compilation error occurs in Shop.
  • C. A compilation error occurs in Bread
  • D. A compilation error occurs in
  • E. All classes compile successfully.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

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
adnano1234
Highly Voted 4 years, 6 months ago
The answer is C: Final method cannot be overridden, it could be only overloaded
upvoted 5 times
...
asdfjhfgjuaDCV
Most Recent 4 months, 3 weeks ago
Compilation error occurs in Bread:Answer is C Compile Errors : ./Main.java:14: error: bake(int,int) in Bread cannot override bake(int,int) in Cake public void bake(int minutes, int temperature) {} ^ overridden method is final
upvoted 2 times
...
iSnover
5 months, 3 weeks ago
Selected Answer: C
The answer is C, Final method cannot be overridden, it could be only overloaded.
upvoted 1 times
...
steefaand
5 months, 3 weeks ago
Selected Answer: C
C is correct, as final method can't be overridden.
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