Which two allow the class Thing to be instantiated using new

题目
多选题
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) {} }

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

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

第2题:

Which two are true?()

  • A、 An encapsulated, public class promotes re-use.
  • B、 Classes that share the same interface are always tightly encapsulated.
  • C、 An encapsulated class allows subclasses to overload methods, but does NOT allow overriding methods.
  • D、 An encapsulated class allows a programmer to change an implementation without affecting outside code.

正确答案:A,D

第3题:

有如下程序: include using namespaee std; class ONE{ public: virtual void f

有如下程序:

include <iostream>

using namespaee std;

class ONE{

public:

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

};

class TWO:public ONE{

public:

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

{;

class THREE:public TWO{

public:

virtual void f( )}TWO::f( );cout<<"3";}

};

int main( ){

ONE aa,*P;

TWO bb;

THREE cc;

P=&cc;

p->f( );

return 0;

}

程序的输出结果是______。


正确答案:2213
2213 解析:TWO bb;调用TWO的构造函数打印2;THREE cc;调用继承类TWO的构造函数打印2;p->f( );调用类TREE的函数f( ),先显式调用TWO类的函数f( ),TWO中没有重新定义f( )函数,所以调用TWO的基类ONE的虚函数f( );打印1,然后再打印3,故答案为2213。

第4题:

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

第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题:

Which two are characteristics of the cost-containment business challenge?()

  • A、reducing security breaches
  • B、using the Internet more
  • C、reducing upgrade charges
  • D、adopting new applications and services

正确答案:C,D

第7题:

A team of programmers is reviewing a proposed API for a new utility class.After some discussion, they realize that they can reduce the number of methods in the API without losing any functionality.If they implement the new design, which two principles will they be promoting?()

  • A、Looser coupling
  • B、Tighter coupling
  • C、Lower cohesion
  • D、Higher cohesion
  • E、Weaker encapsulation
  • F、Stronger encapsulation

正确答案:A,D

第8题:

有如下程序: include using namespace std; class ONE { public: virtual void f() {

有如下程序:

include <iostream>

using namespace std;

class ONE

{

public:

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

};

class TWO: public ONE

{

public:

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

};

class THREE: public TWO

{

public:

virtual void f() {TWO::f(); cout << "3"; }

};

int main()

{

ONE aa, *p;

TWO bb;

THREE cc;

p=&cc;

P->f();

return 0;

}

执行上面程序的输出是【 】。


正确答案:2213
2213

第9题:

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

第10题:

Which two statements best describe CBWFQ?()

  • A、The CBWFQ scheduler provides a guaranteed minimum amount of bandwidth to each class.
  • B、CBWFQ services each class queue using a strict priority scheduler.
  • C、The class-default queue only supports WFQ.
  • D、Inside a class queue, processing is always FIFO, except for the class-default queue.

正确答案:A,D

更多相关问题