多项选择题
Which two statements are true regarding the creation of a default constructor?()
A. The default constructor initializes method variables.
B. The default constructor invokes the no-parameter constructor of the superclass.
C. The default constructor initializes the instance variables declared in the class.
D. If a class lacks a no-parameter constructor,, but has other constructors, the compiler creates a default constructor.
E. The compiler creates a default constructor only when there are no other constructors for the class.
相关考题
-
单项选择题
Youwantaclasstohaveaccesstomembersofanotherclassinthesamepackage.Whichisthemostrestrictiveaccessmodifierthatwillaccomplishthatwillaccomplishthisobjective?()
A. Public
B. Private
C. Protected
D. Transient
E. No access modifier is required. -
单项选择题
Whichwilldeclareamethodthatisavailabletoallmembersofthesamepackageandcanbereferencedwithoutaninstanceoftheclass?()
A. Abstract public void methoda();
B. Public abstract double methoda();
C. Static void methoda(double d1){}
D. Public native double methoda() {}
E. Protected void methoda(double d1) {} -
单项选择题
//point X public class foo { public static void main (String[]args) throws Exception { java.io.printWriter out = new java.io.PrintWriter { new java.io.outputStreamWriter (System.out), true; out.printIn(“Hello”); } } } Which statement at PointX on line 1 allows this code to compile and run?()
A. Import java.io.*;
B. Include java.io.*;
C. Import java.io.PrintWriter;
D. Include java.io.PrintWriter;
E. No statement is needed.
