类Student代码如下: class Student{ String name; int age; Student(String nm){ name = nm; } } 执行语句Student stu = new Student()后,字段age的值是哪项?()
第1题:
A.newStudent()创建了Student对象的一个实例
B.Studentstudent声明了对象Student的一个引用
C.classStudent声明了一个类
D.newStudent()创建了一个类
E.Studentstudent声明了一个类
第2题:
A.0
B.null
C.false
D.编译错误
第3题:
( 30 )下列代码声明了 3 个类
class Person{};
class Student:public Person{};
class Undergraduate:Student{};
下列关于这些类之间关系的描述中,错误的是
A )类 Person 是类 Undergraduate 的基类
B )类 Undergraduate 从类 Student 公有继承
C )类 Student 是类 Person 的派生类
D )类 Undergraduate 是类 Person 的派生类
第4题:
创建一个名为student的新类,保存新类的类库名称是mylib,新类的父类是Person,正确的命令是
A.CREATE CLASS mylib OF student As Pemon
B.CREATE CLASS student OF Pe~on As mylib
C.CREATE CLASS student 0F mylib As Pe~on
D.CREATE CLASS Person OF mylib As student
第5题:
如下两个源程序文件,分别编译后,运行Example.class文件,运行结果为______。
AB.java文件代码如下;
package test;
public class AB
{
int a=60;
public void show()
{
System.out.println(”a=”+a);
}
Example.java文件代码如下:
import test.AB;
class Example
{
public static void main(String args[])
{
AB bj=new AB();
obj.show();
}
}
第6题:
A.Studentstudent声明了一个类
B.newStudent()创建了Student对象的一个实例
C.Studentstudent声明了对象Student的一个引用
D.classStudent声明了一个类
第7题:
A.0
B.null
C.false
D.编译错误
第8题:
下列代码段声明了3个类:class Person();class Student:public Person{};class Undergraduate:Student{};下列关于这些类之间关系的描述中,错误的是( )。
A.类Person是类Undergraduate的基类
B.类Undergraduate从类Student公有继承
C.类Student是类Person的派生类
D.类Undergraduate是类Person的派生类
第9题:
第10题:
设有下面两个类的定义: class Person{ long id // 身份证号 String name; //姓名 } class Student extends Person{ int score: //成绩 int getScore ( ) { return score; } } 则类Person和类Student的关系是( )。
A.包含关系
B.继承关系
C.关联关系
D.无关系