第 1 页 共 6 页 武 汉 大 学 计 算 机 学 院 2008— 2009 学年 度 第一 学期 期 末 考 试 《 JAVA 程 序 设 计》 试 卷 A 专 业 : ___________ 学号: ____________ 姓 名 : _________ 总分:_________ 一、单项选择题(1 0 小题 2 0 分) 1、编译和运行下列代码后结果是:( ) public class Test { static int total = 10; public static void main (String args [ ] ) { new Test(); } public Test () { System
println("In test"); System
println(this); int temp = this
total; if (temp > 5) System
println(temp); } } A
编译器报第2 行有错 B
编译器报第9 行有错 C
在标准输出上打印的内容中有数字 10 D
通过编译,但是产生运行时错误 2、下列类分别在不同的文件中定义:( ) class Vehicle { public void drive() { System
println("Vehicle: drive"); } } class Car extends Vehicle { public void drive() { System
println("Car: drive"); } } public class Test { public static void main (String args []) { Vehicle v; Car c; v = new Vehicle(); c = new Car(