Oracle
1Z0-851 · Question #74
1Z0-851 Question #74: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-851 to reveal the answer and full explanation for question #74. The question stem and answer options stay visible for context.
Question
Given: class ClassA { public int numberOfInstances; protected ClassA(int numberOfInstances) { this.numberOfInstances = numberOfInstances; } } public class ExtendedA extends ClassA { private ExtendedA(int numberOfInstances) { super(numberOfInstances); } public static void main(String[] args) { ExtendedA ext = new ExtendedA(420); System.out.print(ext.numberOfInstances); } } Which statement is true?
Options
- A420 is the output.
- BAn exception is thrown at runtime.
- CAll constructors must be declared public.
- DConstructors CANNOT use the private modifier.
- EConstructors CANNOT use the protected modifier.
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.