重庆足下 重庆足下科技有限公司 版本:V 1.0.1 - 1 - 测试题(笔试) J a v a 面向对象 重庆足下 科 技 有 限 公 司 重庆足下 重庆足下科技有限公司 版本:V1.0.1 - 2 - 不定项选择题(4 0 题,每题2 .5 分,总分1 0 0 分,测试时间2 小时) 1) 当试图编译并运行下面程序时会出现什么结果()(单选) class A{ public int getNumber(int a){ return a+1; } } class B extends A{ public int getNumber(int a, char c){ return a+2; } public static void main(String[] args){ B b=new B(); System.out.println(b.getNumber(0)); } } a) 编译错误 b) 运行错误 c) 1 d) 2 2) 当编译并运行下面程序时会出现什么结果( )(单选) public class MyAr{ public static void main(String argv[]){ int[] i = new int[5]; System.out.println(i[5]); } } a) 编译错误 b) 运行错误 c) 输出0 d) 输出“null” 3) final、finally、finalize 三个关键字的区别是()(多选) a) final 是修饰符(关键字)可以修饰类、方法、变量 b) finally 在异常处理的时候使用,提供 finally 块来执行任何清除操作 c) finalize 是方法名,在垃圾收入集器将对象从内存中清除出去之前做必要的清理工作 d) finally 和 finalize 一样都是用异常处理的方法 重庆足下 重庆足下科技有限公司 版本:V1.0.1 - 3 - 4) 当编译并运行下面程序时会发生什么结果()(单选) public class Bground extends Thread{ public static void main(String argv[]){ Bground b = new Bground(); b.run(); } public void start(){ for (int i = 0; i <10; i++){ System.out.println("Value of i = " + i); } } } a) 编译错误,指明run 方法没有定义 b) 运行错误,指明run 方法没有定义 c) 编译通过并输出0 到9 d) 编译通过但无输出 5) 在Java 中,如果父类中的某些方法不包含任何逻辑,并且需要由子类重写,应该使用()关键字来声明父类的这些方法。(单选) a) Final b) Static c) Abstract d) Void 6) 当编译并运行下面程序时会发生什么结果:(单选) public class Hope{ public static void main(String argv[]){ Hope h = new Hope(); } protected Hope(){ for(int i...