Oracle
1Z0-851 · Question #35
1Z0-851 Question #35: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-851 to reveal the answer and full explanation for question #35. The question stem and answer options stay visible for context.
Question
Given: class Foo { public int a = 3; public void addFive() { a += 5; System.out.print("f "); } } class Bar extends Foo { public int a = 8; public void addFive() { this.a += 5; System.out.print("b " ); } } Invoked with: Foo f = new Bar(); f.addFive(); System.out.println(f.a); What is the result?
Options
- Ab 3
- Bb 8
- Cb 13
- Df 3
- Ef 8
- Ff 13
- GCompilation fails.
- HAn exception is thrown at runtime.
Unlock 1Z0-851 to see the answer
You've previewed enough free 1Z0-851 questions. Unlock 1Z0-851 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.