Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Oracle Exam 1Z0-809 Topic 2 Question 41 Discussion

Actual exam question for Oracle's 1Z0-809 exam
Question #: 41
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?

Show Suggested Answer Hide Answer
Suggested Answer: D

Contribute your Thoughts:

Genevive
1 months ago
I'll have to go with E on this one. The code looks pretty straightforward, and I don't see any compilation errors. Maybe the developers were craving some ice cream while they were writing this?
upvoted 0 times
Buffy
7 days ago
Maybe they were inspired by ice cream flavors!
upvoted 0 times
...
Thurman
13 days ago
I agree, the code seems to be error-free.
upvoted 0 times
...
Kenneth
14 days ago
E) All classes compile successfully.
upvoted 0 times
...
...
Willow
1 months ago
Hmm, this is a tricky one. I'm going to go with E, since the code doesn't seem to have any obvious issues. But if I was the developer, I would have made the `bake()` method in `Cake` non-final, just to keep things consistent.
upvoted 0 times
...
Clay
1 months ago
Haha, I bet the developers who wrote this code were really trying to trip us up! But E is the right answer. All the classes are valid Java code.
upvoted 0 times
Mendy
3 days ago
Definitely! The developers did a good job, no compilation errors in any of the classes.
upvoted 0 times
...
Fannie
8 days ago
Yeah, the code looks tricky but it's actually all valid Java code.
upvoted 0 times
...
Tommy
15 days ago
I agree, E is the correct answer. All the classes compile successfully.
upvoted 0 times
...
...
Sherita
2 months ago
I'm not sure, but I think E) All classes compile successfully could also be a valid answer.
upvoted 0 times
...
Leonie
2 months ago
I think the answer is B. There's a compilation error in the `Cake` class because the `bake()` method is marked as `final`, so it can't be overridden in the `Bread` class.
upvoted 0 times
Dominque
1 months ago
Yes, you're right. The `final` keyword prevents the `bake()` method from being overridden in the `Bread` class, leading to a compilation error in `Cake`.
upvoted 0 times
...
Bernardo
2 months ago
I agree, the answer is B. The `final` keyword in the `bake()` method causes a compilation error in the `Cake` class.
upvoted 0 times
...
...
Benton
2 months ago
The correct answer is E. All classes compile successfully. The `prepare()` method in `IceCream` is public, so there's no compilation error. The `bake()` method in `Cake` is also valid, and `Shop` can create an instance of `Cake`. The `Bread` class extends `Cake`, so the `bake()` method overrides the one in `Cake`.
upvoted 0 times
Lura
14 days ago
And `Shop` can create an instance of `Cake`.
upvoted 0 times
...
Noel
16 days ago
The `bake()` method in `Cake` is also valid.
upvoted 0 times
...
Rory
18 days ago
Yes, you're right. The `prepare()` method in `IceCream` is public.
upvoted 0 times
...
Eleni
26 days ago
I think the correct answer is E. All classes compile successfully.
upvoted 0 times
...
...
Chauncey
2 months ago
I agree with Ilona, because the method signature in Bread does not match the one in Cake.
upvoted 0 times
...
Ilona
3 months ago
I think the answer is D) A compilation error occurs in Bread.
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77