Oracle
1Z0-819 · Question #74
Given public class X { } and public final class Y extends X { } What is the result of compiling these two classes?
The correct answer is D. The compilation succeeds. See the full explanation below for the reasoning.
Question
Given
public class X {
}
and
public final class Y extends X {
}
What is the result of compiling these two classes?
Options
- AThe compilation fails because there is no zero-args constructor defined in class X.
- BThe compilation fails because class X or class Y needs to implement the toString() method.
- CThe compilation fails because a final class cannot extend another class.
- DThe compilation succeeds.
How the community answered
(44 responses)- A9% (4)
- B5% (2)
- C5% (2)
- D82% (36)
Community Discussion
No community discussion yet for this question.