Oracle
1Z0-804 · Question #11
Given the classes: What is the result?
The correct answer is B. unknown Harry. getName() is missing in John, hence Pupils getName() is invoked and the String in Pupils scope
Java Class Design
Question
Given the classes:
What is the result?
Exhibit
Options
- AJohn Harry
- Bunknown Harry
- Cjohn unknown
- Dunknown unknown
- ECompilation fails.
- FAn exception is thrown at runtime.
How the community answered
(17 responses)- B82% (14)
- C6% (1)
- E12% (2)
Explanation
getName() is missing in John, hence Pupils getName() is invoked and the String in Pupils scope
Topics
#field initialization#constructor chaining#default values#inheritance
Community Discussion
No community discussion yet for this question.
