Oracle
1Z0-803 · Question #227
1Z0-803 Question #227: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-803 to reveal the answer and full explanation for question #227. The question stem and answer options stay visible for context.
Question
Given: class Cake { int model; String flavor; Cake() { model = 0; flavor = "Unknown"; } } public class Test { public static void main(String[] args) { Cake c = new Cake(); bake1(c); System.out.println(c.model + " " + c.flavor); bake2(c); System.out.println(c.model + " " + c.flavor); } public static Cake bake1(Cake c) { c.flavor = "Strawberry"; c.model = 1200; return c; } public static void bake2(Cake c) { c.flavor = "Chocolate"; c.model = 1230; return; } } What is the result?
Options
- A0 unknown
- B1200 Strawberry
- C1200 Strawberry
- DCompilation fails
Unlock 1Z0-803 to see the answer
You've previewed enough free 1Z0-803 questions. Unlock 1Z0-803 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.