多选题Which two allow the class Thing to be instantiated using new Thing()?Apublic class Thing { }Bpublic class Thing { public Thing() {} }Cpublic class Thing { public Thing(void) {} }Dpublic class Thing { public Thing(String s) {} }Epublic class Thing { pub

题目
多选题
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,C
解析: 暂无解析
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Page, the naughtiest boy in the class, did this thing on ____, knowing it would make her crazy.

A、time

B、duty

C、hand

D、purpose


正确答案:D

第2题:

To qualify for a promotion, ()to exceed the quota.

Athe best thing he could do was

Bhe did his best

Call he could do was

Dhis best thing was


B

第3题:

下列标识符中,()不是正确的变量名。

A.thing1

B.one-hundred

C.int

D.1thing


正确答案:BCD

第4题:

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,B

第5题:

In which two cases does the compiler supply a default constructor for class A?()  

  • A、 class A{}
  • B、 class A { public A(){} }
  • C、 class A { public A(int x){} }
  • D、 class Z {} class A extends Z { void A(){} }

正确答案:A,D

第6题:

有下列程序:includeusing namespace std;class ONE{ public:virtual void f(){COUt<<"

有下列程序:

include<iostream>

using namespace std;

class ONE

{

public:

virtual void f(){COUt<<"1";}

};

c1assTWO:public ONE

{

public:

TWO(){cout<<"2";}

};

class THREE:public TWO

{

pub


正确答案:2213
2213 解析: 此题考查的是派生类的构造和析构函数。建立TWO的对象bb时,调用TWO的构造函数,输出“2”;THREE类又派生于TWO类,所以建立THREE类的对象cc时又会输出“2”;ONE类的对象指针p指向了THREE类的ONE类的虚函数f(),输出“1”;最后调用THREE类的f(),输出“3”。故最终的输出结果是2213。

第7题:

public class SomeException {  } Class a:  public class a {  public void doSomething() { }  } Class b:  public class b extends a {  public void doSomething() throws SomeException { }  }  Which is true about the two classes?() 

  • A、 Compilation of both classes will fail.
  • B、 Compilation of both classes will succeed.
  • C、 Compilation of class a will fail. Compilation of class b will succeed.
  • D、 Compilation of class a will fail. Compilation of class a will succeed.

正确答案:D

第8题:

Given:Which two, inserted at line 11, will allow the code to compile?()

A.public class MinMax<?> {

B.public class MinMax<? extends Number> {

C.public class MinMax<N extends Object> {

D.public class MinMax<N extends Number> {

E.public class MinMax<? extends Object> {

F.public class MinMax<N extends Integer> {


参考答案:D, F

第9题:

1. public interface A {  2. public void doSomething(String thing);  3. }  1. public class AImpl implements A {  2. public void doSomething(String msg) { }  3. }  1. public class B {  2. public A doit() {  3. // more code here  4. }  5.  6. public String execute() { 7. // more code here  8. }  9. }  1. public class C extends B {  2. public AImpl doit() {  3. // more code here  4. }  5.  6. public Object execute() {  7. // more code here  8. }  9. }  Which statement is true about the classes and interfaces in the exhibit?() 

  • A、 Compilation will succeed for all classes and interfaces.
  • B、 Compilation of class C will fail because of an error in line 2.
  • C、 Compilation of class C will fail because of an error in line 6.
  • D、 Compilation of class AImpl will fail because of an error in line 2.

正确答案:C

第10题:

Given that Thing is a class, how many objects and reference variables are created by the following code?()   Thing item, stuff;   item = new Thing();   Thing entity = new Thing();

  • A、One object is created
  • B、Two objects are created
  • C、Three objects are created
  • D、One reference variable is created
  • E、Two reference variables are created
  • F、Three reference variables are created.

正确答案:B,F

更多相关问题