网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

下列关于Test类的定义中,正确的是( )。

A.

B.

C.

D.


参考答案

更多 “ 下列关于Test类的定义中,正确的是( )。A.B.C.D. ” 相关考题
考题 有如下类定义:class Test{public:Test(){ a = 0; c = 0;} // ①int f(int a)const{this-a = a;} // ②static int g(){return a;} // ③void h(intB . {Test::b = b;}; // ④private:int a;static int b;const int c;};int Test::b = 0;在标注号码的行中,能被正确编译的是A . ①B . ②C . ③D . ④

考题 已知程序中已经定义了函数test,其原型是int test(int,int,int);,则下列重载形式中正确的是A.char test (int,int,int);B.double test(int,int,double);C.int test(int,int,int=O);D.float test(int,int,float=3.5F);

考题 ( 12 )下列关于类定义的说法中,正确的是A )类定义中包括数据成员和函数成员的声明B )类成员的缺省访问权限是保护的C ) 数据成员必须被声明为私有的D )成员函数只能在类体外进行定义

考题 ( 18 )下列枚举类型的定义中,包含枚举值 3 的是A ) enum test {RED, YELLOW, BLUE, BLACK};B ) enum test {RED, YELLOW=4, BLUE, BLACK};C ) enum test {RED=-1, YELLOW,BLUE, BLACK};D ) enum test {RED, YELLOW=6, BLUE, BLACK};

考题 阅读下面程序class Test implements Runnable{public static void main(String[] args){Test t = new Test();t.start();}public void run(){ }}下列关于上述程序的叙述正确的是A) 程序不能通过编译,因为 start() 方法在 Test 类中没有定义B) 程序编译通过,但运行时出错,提示 start() 方法没有定义C) 程序不能通过编译,因为 run() 方法没有定义方法体D) 程序编译通过,且运行正常

考题 如果使用 Thread t = new Test() 语句创建一个线程,则下列叙述正确的是A)Test 类一定要实现 Runnable 接口B)Test 类一定是 Thread 类的子类C)Test 类一定是 Runnable 的子类D)Test 类一定是继承 Thread 类并且实现 Runnable 接口

考题 下列关于Java源程序结构的论述中,正确的是______。A) 一个文件包含的import语句最多1个B) 一个文件包含的public类最多1个C) 一个文件包含的接口定义最多1个D) 一个文件包含的类定义最多1个A.B.C.D.

考题 下列关于Test类的定义中,正确的是______。A) class Test implements Runnabte{public void run(){}public void someMethod(){}B) class Test implements Rnuuable{public void run();}C) class Test implements Rnuuable{public void someMethod();}D) class Test implements Rnuuable{public void someMethod();{}}A.B.C.D.

考题 下列关于类定义的说法中,正确的是A.类定义中包括数据成员和函数成员的声明B.类成员的缺省访问权限是保护的C.数据成员必须被声明为私有的D.成员函数只能在类体外进行定义

考题 下列关于私有继承的说法中正确的是()。A、基类成员对派生类新定义的成员函数是不可见的;B、基类成员对派生类新定义的成员函数是可见的;C、只有基类成员中的公有成员对派生类新定义的成员函数是可见的;D、基类成员中的保护成员对派生类新定义的成员函数是可见的。

考题 在如下源代码文件Test.java中, 哪个是正确的类定义?() A.public class test { public int x = 0; public test(int x) { this.x = x; } }B.public class Test{ public int x=0; public Test(int x) { this.x = x; } }C.public class Test extends T1, T2 { public int x = 0; public Test (int x) { this.x = x; } }D.public class

考题 在如下结构定义中,不正确的是()。A.B.C.D.

考题 应在下面程序下划线中填写的正确的语句是( )。 include using namespace std; 应在下面程序下划线中填写的正确的语句是( )。 #include <iostream> using namespace std; class A{ public: void test(){cout<< "this is A!";} }; class B:public A{ void test(){ ______ //显示调用基类函数test() cout<< "this is B!"; } }; void main(){}A.A::test()B.test()C.B::test()D.this->test()

考题 已知有下列类的说明,则下列( )语句是正确的。 publicClass Test{ private float f=1.0f; int m=12; static int n=1: public static void main(Stringarg[]){ Test t=new Test(): } }A.t.f;B.this.n;C.Test.m;D.Test.f;

考题 阅读下面程序 class Test implements Runnable { public static void main(String[] args) { Test t=new Test(); t.start(): } public void run() {} } 下列关于上述程序的叙述正确的是A.程序不能通过编译,因为start()方法在Test类中没有定义B.程序编译通过,但运行时出错,提示start()方法没有定义C.程序不能通过编译,因为run()方法没有定义方法体D.程序编译通过,且运行正常

考题 如果使用Thread t=new Test()语句创建一个线程,则下列叙述正确的是A.Test类一定要实现Runnable接口B.Test类一定是Thread类的子类C.Test类一定是Runnable的子类D.Test类一定是继承Thread类并且实现Runnable接口

考题 有如下类定义: class Test { public: Test(){a=0;c=0} //① int f(int a)const{this->a=a;} //② static int g(){return a;} //③ void h(int b){Test::b;}; //④ private: int a; static int b; const int C; }; int Test::b=0; 在标注号码的行中,能被正确编译的是( )。A.①B.②C.③D.④

考题 下列对结构体类型变量定义不正确的是() A.B.C.D.

考题 下列关于Test类的定义中,正确的是( )。A.class Test implements Runnable{ public void run{} Dublic void someMethod[]{} }B.class Test implements Runnable( puIblic void run; }C.class Test implements Runnable( Dublic void someMethod[]; }D.class Test implements Runnable( public void someMethod{} }

考题 有如下类定义: class Test { public: Test{a=0;c=0;}//① int f(im A.const{this-a=a;}//② static int g{return a;f//③ void h(int B.{Test:.b=b;};//④ private: int a; static int b; const int C; }; int Test::b=0: 在标注号码的行中,能被正确编译的是( )。A.①B.②C.③D.④

考题 有如下类定义: class Test { int x_,y_; public: Test ():a_(0) ,b_(0) {} Test(int a,int b=0) :a_(a),b_(b){} }; 若执行语句 Test x(2) ,y[3],*z[4]; 则Test类的构造函数被调用的次数是( )。A.2次B.3次C.4次D.5次

考题 以下关于子类和父类的叙述中,正确的是______。A.代码中使用父类对象的地方,都可以使用子类对象替换B.代码中使用子类对象的地方,都可以使用父类对象替换C.父类定义的对象与子类定义的对象在属性和方法上一定相同D.父类定义的对象与子类定义的对象在属性和方法上一定不同A.B.C.D.

考题 在下列源代码文件Test.java中, ( )是正确的类定义。A.public class test{B.public class Test{ public int x=0;public int x=0; public test (intx) public Test (int x){ {this.x=x; this.x=x;} }} }C.public class Test extends T1,T2{D.protected class Test extends T2{ public int=0;public int x=0; public Test(int x){Public Test (int x){ this.x=x;this.x=x: }} }}

考题 关于下面程序,( )的结论是正确的。classJ_SubClassextendsJ_Test{}publicclassJ_Test{J_Test(inti){System.out.println(i);}publicstaticvoidmain(String[]args){J_SubClassa=newJ_SubClass();}}A、不能通过编译,因为类J_Test没有定义无参数的构造方法B、不能通过编译,因为类J_SubClass没有定义无参数的构造方法C、不能通过编译,因为没有实现J_SubClass(inti)的构造方法D、可以成功通过编译

考题 下列选项中,能正确定义数组的语句是( )。A.B.C.D.

考题 在下列源代码文件Test.java中,哪个选项是正确的类定义? ( )A.public class test { public int x=0; public test(int x) { this.x=x; } }B.public class Test { public int x=0; public Test(int x) { this.x=x; } }C.public class Test extends Ti,T2 { public int x=0; public Test(int x) { this.x=x; } }D.protected class Test extends T2 { public int x=0; public Test(int x) { this.x=x; } }

考题 下列关于类层次中静态成员的描述,正确的是()A、在基类中定义的静态成员,只能由基类的对象访问B、在基类中定义的静态成员,在整个类体系中共享C、在基类中定义的静态成员,不管派生类以何种方式继承,在类层次中具有相同的访问性质D、一旦在基类中定义了静态成员,就不能在派生类中再定义