Java认证考试

class ThreadBoth extends Thread implements Runnable {  public void run(){ System.out.print("hi "); }  public static void main(String [] args){  Thread t1 = new ThreadBoth();   Thread t2 = new Thread(t1);  t1.run();  t2.run();  }  }  结果为:() A、hiB、hi hiC、编

题目

class ThreadBoth extends Thread implements Runnable {  public void run(){ System.out.print("hi "); }  public static void main(String [] args){  Thread t1 = new ThreadBoth();   Thread t2 = new Thread(t1);  t1.run();  t2.run();  }  }  结果为:() 

  • A、hi
  • B、hi hi
  • C、编译失败
  • D、代码运行,但无输出结果
如果没有搜索结果,请直接 联系老师 获取答案。
如果没有搜索结果,请直接 联系老师 获取答案。
相似问题和答案

第1题:

下面程序输出的结果为

#include"iostream.h"

class A

{

public:

A( ){cout<<"CLASS A"<<endl;}

~A( ){}

};

class B:public A

{

public:

B( ){cout<<"CLASS B"<<endl;}

~B( ){}

};

void main( )

{

A*p;

p=new B;

B *q;

q=new B;

}

A.CLASS A CLASS B

B.CLASS A CLASS B CLASS B

C.CLASS A CLASS B CLASS A CLASS B

D.CLASS A CLASS B CLASS B CLASS B


正确答案:C
解析:每实例化一个类就要调用其构造函数,结束运行该实例后调用析构函数。注意:类的实例化和构造函数、析构函数的调用方式和何时调用。

第2题:

The IP address 192.168.100.1 belongs to which class of IP address space?()

A. Class A

B. Class B

C. Class C

D. Class D


参考答案:C

第3题:

将当前表文件内容复制到工资.DBF中的命令是______。

A.COPY TO工资

B.COPY FILE TO工资

C.COPY STRU TO工资

D.COPY STRU EXTE TO工资


正确答案:A

第4题:

Into which two types of areas would an area border router (ABR) inject a default route?()

A. stub

B. the autonomous system of an exte rior gateway protocol (EGP)

C. NSSA

D. totally stubby

E. the autonomous system of a different interior gateway protocol (IGP)

F. area 0


参考答案:A, D

第5题:

下面程序输出的结果为( )。 #inClUde”iostream.h” Class A {public: A(){cout<<“CLASS A”<<endl;} ~A()<)}; class B:public A {public: B(){cout<<”CLASSB”<<endl;} ~B(){}}; void main() {A*p; p=new B; B *q; q=new B;}

A.CLASS A CLASS B

B.CLASS A CLASS B CLASS B

C.CLASS A ClASS B

D.CLASS A CLASS B CLASS A CLASS B CLASS B CLASS B


正确答案:C
解析: 本题考查类的继承、类的实例化和构造函数、析构函数的调用方式和何时调用。每实例化一个类就要调用其构造函数,结束运行该实例后调用析构函数。

第6题:

Class a = new Class(); Class b = new Class();

if(a == b) returns true or false, why?


正确答案:
               

第7题:

下面程序输出的结果为 #include"iostream.h” class A { public: A(){cout<<"CLASSA"<<endl;} ~A() {} }; class B:public A { public: B(){cout<<"CLASS B"<<endl;} ~B(){} }; void main() { A*p; p=new B;

A.CLASS A CLASS B CLASS B CLASS B

B.CLASS A CLASS B CLASS A CLASS B

C.CLASS A CLASS B CLASS B

D.CLASS A CLASS B


正确答案:C

第8题:

下面程序输出的结果为 #include"iostream.h" class A { public: A(){cout<<"CLASSA"<<endl;} ~A() {} }; class B:public A { public: B(){cout<<"CLASSB"<<endl;} ~B() {} }; void main() { A * p; p=new B; B *q; q=new B; }

A.CLASS A CLASS B

B.CLASS A CLASS B CLASS B

C.CLASS A CLASS B CLASS A CLASS B

D.CLASS A CLASS B CLASS B CLASS B


正确答案:C
解析:每实例化一个类就要调用其构造函数,结束运行该实例后调用析构函数。注意:类的实例化和构造函数、析函数的调用方式和何时调用。

第9题:

对于下面( )类定义,可以通过“newJ_Class()”生成类J_Class的实例对象。

A、publicclassJ_Class{

publicJ_Class(void){}

}

B、publicclassJ_Class{}

C、publicclassJ_Class{

publicJ_Class(Strings){}

}

D、publicclassJ_Class{

publicvoidJ_Class(){}

publicJ_Class(Strings){}


正确答案:B

第10题:

Which statement is NOT true concerning the stowage of class 1 explosives ________.

A.Class 1.1 explosives may be stowed with class 9 dangerous substances

B.Class 1.4 explosives must be“separated from”a stow of class 5.1 oxidizing materials

C.Class 1.4 explosives may not be stowed in the same hold with class 6.1 poisons

D.Class 1.4 explosives must be“separated from”a stow of class 8 corrosive materials


正确答案:C

更多相关问题