SCJP:In which two cases does the compiler supply a default constructor for class A? (Choose two.)
A. class A {}
B. class A { public A() { } }
C. class A { public A(int x) { } }
D. class A{ void A(){ } }
查看答案
SCJP: Which two allow the class Thing to be instantiated using new Thing()? (Choose two.)
A. public class Thing { }
B. class Thing { public Thing(){ } }
C. public class Thing{ public Thing(void){ } }
D. public class Thing{ public Thing(String s){ } }
E. public class Thing{ public void Thing(){ } public Thing(String s){ } }
用 修饰的类叫抽象类。抽象类只能被继承,不能被实例化。用 修饰的类叫最终类,只能被实例化,不能被继承。