易搜题 > 资格证大类 > 计算机编程 > 问题详情
问题详情

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) {} }

未找到的试题在搜索页框底部可快速提交,在会员中心"提交的题"查看可解决状态。 收藏该题
查看答案

相关问题推荐

  • Which statement is true?()

    A、 Compilation succeeds.

    B、 class A does not compile.

    C、 The method declared on line 9 cannot be modified to throw TestException.

    D、 TestA compiles if line 10 is enclosed in try/catch block that catches TestException.

  • What is the result?()

    A、 Compilation fails.

    B、 An exception is thrown at runtime.

    C、 The code executes normally and prints "sleep".

    D、 The code executes normally, but nothing is printed.

  • int index = 1;  int [] foo = new int [3];  int bar = foo [index];  int baz = bar + index;   What is the result?()  

    A、 Baz has the value of 0

    B、 Baz has the value of 1

    C、 Baz has the value of 2

    D、 An exception is thrown.

    E、 The code will not compile.

  • 1. class super {  2. public float getNum() {return 3.0f;}  3. }  4.    5. public class Sub extends Super { 6.   7. }   Which method, placed at line 6, will cause a compiler error?()  

    A、  Public float getNum()   {return 4.0f; }

    B、  Public void getNum ()  { }

    C、  Public void getNum (double d)   { }

    D、  Public double getNum (float d) {retrun 4.0f; }

  • 1. class SuperClass {  2. public a geta() {  3. return new a();  4. }  5. }  6. class SubClass extends SuperClass {  7. public b geta() {  8. return new b();  9. }  10. }  Which is true?() 

    A、 Compilation will succeed if a extends b.

    B、 Compilation will succeed if b extends a.

    C、 Compilation will always fail because of an error in line 7.

    D、 Compilation will always fail because of an error in line 8.

联系客服 会员中心
TOP