最新java面试题(A)卷要点.doc
《最新java面试题(A)卷要点.doc》由会员分享,可在线阅读,更多相关《最新java面试题(A)卷要点.doc(58页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、Four short words sum up what has lifted most successful individuals above the crowd: a little bit more.-author-datejava面试题(A)卷要点空间互动笔试题(A)空间互动笔试题(A)1. 下列数组初始化正确的是:CA int5 a= 1,2,3,4,5;B int22 a = 1,2,3,4;C int a = 2,3,4,5,new int3;D int a = new int5;2. 关于下述程序:public class Dividepublic static void ma
2、in(String args)System.out.println(17.0/0 = +17.0/0); System.out.println(17/0 = +17/0); 描述正确的是?CA.编译出错B.编译通过,运行时/1、/2处均出现异常C.编译通过,运行时/1处得到一个无穷大值,/2处将出现异常D.编译通过,运行时/1处出现异常,/2处将得到一个无穷大值3. 关于下面的类描述中正确的是:Cclass Test void test(int i) System.out.println(I am an int.); void test(String s) System.out.println
3、(I am a string.); public static void main(String args) Test t=new Test(); char ch=y; t.test(ch); A. 编译出错B. 编译通过,运行出错C. 编译通过,运行时输出“I am an int”D. 编译通过,运行时输出“I am a string”4. 当编译和运行下列程序段时,会发生什么?Cclass Base class Sub extends Base class Sub2 extends Base public class CEx public static void main(String a
4、rgv) Base b = new Base(); Sub s = (Sub) b; A 通过编译和并正常运行。 B 编译时出现错误。 C 编译通过,运行时出现异常。 D 以上都错5. 下面哪些是java语言中的关键字? B A sizeof B abstract C NULL D Native 6. class ExSuper String name; String nick_name; public ExSuper(String s,String t) name = s;nick_name = t; public String toString() return name; public
5、class Example extends ExSuper public Example(String s,String t) super(s,t); public String toString() return name +a.k.a+nick_name; public static void main(String args)ExSuper a = new ExSuper(First,1st);ExSuper b = new Example(Second,2nd);System.out.println(a is+a.toString();System.out.println(b is+b
6、.toString();运行结果是 C A 编译时会出现例外。 B 运行结果为:a is Firstb is second C 运行结果为:a is Firstb is Secong a.k.a 2nd D 运行结果为:a is First a.k.a 1ndb is Second a.k.a 2nd7. public class Foo public static void main(String args) tryreturn; finallySystem.out.println(Finally); 结果是: D A 程序正常运行,但不输出任何结果。 B 程序正常运行,并输出 Finall
7、y。 C 编译能通过,但运行时会出现一个例外。 D 因为没有catch语句块,所以不能通过编译。 8. package语句正确的是A A 必须在程序开头 B 不一定在程序开头 C 可以在import之后 D 包名可以以数字开头 9. java中,关于char类型错误的是BA 占2字节B 可以存储一个英文字母C 不能存储一个汉字D 其对应的封装类是Character10. 关于内部类错误的是:AA 静态内部类可以访问其外部类的非静态属性B 非静态内部类可以访问其外部类的静态属性C 内部类可以是protectedD 内部类可以是final的11. Vector 与 ArrayList正确的是: C
8、A ArrayList 出现比Vector早 B ArrayList 速度比Vector慢 C ArrayList 没有同步保护,Vector具有同步保护 D ArrayList Vector 两者都是无序的集合12. Which of the following lines of code will compile without error? DA. int i=0; if (i) System.out.println(“Hi”); B. boolean b=true; boolean b2=true; if(b=b2) System.out.println(“So true”); C.
9、int i=1; int j=2; if(i=1! j=2) System.out.println(“OK”); D. int i=1; int j=2; if (i=1 &| j=2) System.out.println(“OK”); 13. 下列程序 Cclass A public static void main(String args) B b = new B();b.run();for (int i=0;i30;i+)System.out.println(good);class B extends Threadpublic void run()for (int i=0;i30;i+
10、)System.out.println(hello);A 编译错误B 编译正确,执行时good hello交替输出C 编译正确,执行时先输出30个hello再输出30个goodD 编译正确,程序运行时出现异常14. FileInputStream和FileOutputStream错误的是 CA 是字节流B 是节点流C 用其拷贝文件时,不能拷贝中文D 可以拷贝任何文本文件和2进制文件。15. 一个类中那些内容可以在序列化时写入文件或发送到网络上 DA transient 修饰的属性B 静态属性C 方法D 类名16. What happens when you try to compile and
11、 run the following application? Choose all correct options. public class Z public static void main(String args) new Z(); Z() Z alias1 = this; Z alias2 = this; synchronized(alias1) try alias2.wait(); System.out.println(“DONE WAITING”); catch (InterruptedException e) System.out.println(“INTERRUPTED”);
12、 catch (Exception e) System.out.println(“OTHER EXCEPTION”); finally System.out.println (“FINALLY”); System.out.println(“ALL DONE”); A. The application compiles but doesnt print anything. B. The application compiles and print “DONE WAITING” C. The application compiles and print “FINALLY” D. The appli
13、cation compiles and print “ALL DONE” E. The application compiles and print “INTERRUPTED” 17. 下列关于关系数据库的说法正确的是:A 贮存在列下的数据不必具有相同数据类型。B 行是唯一的(没有完全相同的行)。C 列有顺序。D 行有顺序。18. 以下sql语句正确的是:A select studentid,depart,count(*) from student group by depart;B select studentid,count(*) from student;C select depart,
14、max(avg(age) from student group by depart;D select studentid,avg(score),max(score) from score group by studentid19. 在JSP中使用标记时,不会出现的属性是:A. nameB. property C. valueD.以上皆不会出现20. 对于JavaBean的属性,下面哪种说法是不正确的: A JavaBean中不一定要有属性B JavaBean类可以不是public的C 要访问和修改JavaBean的属性,应该通过get/set方法 D 如果一个属性只提供了get方法,那么它是只
15、读的 21. Page指令用于定义JSP文件中的全局属性,下列关于该指令用法的描述不正确的是:A 作用于整个JSP页面。B 可以在一个页面中使用多个指令。C 为增强程序的可读性,建议将指令放在JSP文件的开头,但不是必须的。D 指令中的所有属性只能出现一次。22. 要让不同用户共享一个JavaBean的对象则该对象的范围应该设置为:A sessionB pageC applicationD request23. 以下那种请求表明客户端只想接收到响应的头信息,并决定了接收文挡的大小,修改时间。A PUTB GETC TRACED HEAD24. 关于自定义标签的使用不正确的是:A 必须在JSP页
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 最新 java 试题 要点
限制150内