Which statement is true?

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?
A. 420 is the output.
B. An exception is thrown at runtime.
C. All constructors must be declared public.
D. Constructors CANNOT use the private modifier.
E. Constructors CANNOT use the protected modifier.

Download Printable PDF. VALID exam to help you PASS.

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.