【单选题】对于下面()类定义,可以通过“new J_Class()”生成类 J_Class 的实例对象。
A. public class J_Class { public J_Class(void) { } } B. public class J_Class { } C. public class J_Class { public J_Class(String s) { } } D. public class J_Class { public void J_Class() { } public J_Class(String s) { } }
A. public class J_Class { public J_Class(void) { } } B. public class J_Class { } C. public class J_Class { public J_Class(String s) { } } D. public class J_Class { public void J_Class() { } public J_Class(String s) { } }
举一反三
- Which two allow the class Thing to be instantiated using new Thing()? A: public class Thing { } B: public 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) {} }
- 若有如下类A的定义,下列哪些类正确继承了该类: abstract class A { abstract void method1(int i); abstract void method2(int j); } A: abstract class B extends A{ void method1( ) { } void method2( ) { } } B: class B { void method1(int i ) { } void method2(int j ) { } } C: class B implements A { void method1(int i ) { } void method2(int j ) { } } D: class B extends A{ public void method1(int x ) { } public void method2(int y ) { } }
- (6-10)编译下面源程序将得到( )文件。 class X1 { } class X2 { } public class Demo3 { class Y1{ class Y2{} } public static void main(String[] args) { } }
- 下面哪一个是正确的类的声明?( ) A: public void HH{…} B: public class Moce(){…} C: public class void number{…} D: public class Car{…}
- 给定代码如下: public abstract interface Frobnicate { public void twiddle(String s); } 以下哪个类是正确的?(). A: public abstract class Frob implements Frobnicate { public abstract void twiddle(String s) { } } B: public abstract class Frob implements Frobnicate { } C: public class Frob extends Frobnicate { public void twiddle(Integer i) { } } D: public class Frob implements Frobnicate { public void twiddle(Integer i) { } }