更多"设有下面的两个类定义: class AA void Show ( "的相关试题:
[单项选择]设有下面的两个类定义: class AA void Show ( ) System.out.println ("I Like Java"): class BB extends AA void Show ( ) System.out.println ("I like C++"); 则顺序执行如下语句后输出的结果为( )。 AA a; BB b; a.Show ( ); b.Show ( );
A. I Like Java I Like C++
B. I Like C++ I Like Java
C. I Like Java I Like Java
D. I Like C++ I Like C++
[单项选择]设有下面两个类的定义:
class Person
long id // 身份证号
String name; //姓名
class Student extends Person
int score: //成绩
int getScore ( )
return score;
则类Person和类Student的关系是( )。
A. 包含关系
B. 继承关系
C. 关联关系
D. 无关系
[单项选择]设有下面两个类的定义: class Person long id;// 身份证号 String name://姓名 class Student extends Person int score://成绩 int getScore( ) return score; 则类Person和类Student的关系是( )。
A. 包含关系
B. 继承关系
C. 关联关系
D. 无关系
[单项选择]有如下两个类定义:
class AA;
class BB
A. )。 v1
B. v2
C. v3 D) v4
[单项选择]下面是类Shape的定义:
class Shape
public:
virtual void Draw( )=0;
下列关于Shape类的描述中,正确的是( )。
A. 类Shape是虚基类
B. 类Shape是抽象类
C. 类Shape中的Draw函数声明有误
D. 语句“Shape s;”能够建立Shape的一个对象s
[单项选择]设有下列两个类的定义,则类Person和类Man的关系是
class Person long id;/ / 身份证号 String name;/ / 姓名 class Man extends Person int age;/ / 年龄 int getScore( ) return score;
A. 包含关系
B. 继承关系
C. 关联关系
D. 无关系,上述类定义有语法错误
[单项选择]设有下列两个类的定义,则类Person和类Man的关系是( )。
class Person {
long id;/ / 身份证号
String name;/ / 姓名
}
class Man extends Person {
int age;/ / 年龄
int getScore( ) {
return score;
}
}
A. -3 3
B. 5 -9
C. 3 -3
D. -6 5
[单项选择]设有如下程序:
public class Sun
public static void main(String args[ ])
int x, y;
x-4;
y=0;
if(Math.pow(x,2)==16)
y=x;
if(Math.pow(x,2)<15)
y=1/x;
if(Math.pow(x,2)>15)
y=(int)Math.pow(x,2)+1;
System.out.println(y);
程序的运行结果是( )。
A. 4
B. 17
C. 18
D. 0.25