Oracle
1Z0-804 · Question #1
Given: Which three values will appear in the output?
The correct answer is A. 5 D. a2 E. b1. Staticmethod of base class is invoked >> A myA = new B(); System.out.print(myA.doA() + myA.doA2() + myA.a); class B String doA() { return "b1 "; } class A protected static String doA2 () { return "a2 "; } class B int a = 7;
RAC Architecture
Question
Given:
Which three values will appear in the output?
Exhibit
Options
- A5
- B7
- Ca1
- Da2
- Eb1
- Fb2
How the community answered
(21 responses)- A81% (17)
- B10% (2)
- C5% (1)
- F5% (1)
Explanation
Staticmethod of base class is invoked >> A myA = new B(); System.out.print(myA.doA() + myA.doA2() + myA.a); class B String doA() { return "b1 "; } class A protected static String doA2 () { return "a2 "; } class B int a = 7;
Topics
#Java code tracing#output prediction#control flow#variable scope
Community Discussion
No community discussion yet for this question.
