资源预览内容
第1页 / 共16页
第2页 / 共16页
第3页 / 共16页
第4页 / 共16页
第5页 / 共16页
第6页 / 共16页
第7页 / 共16页
第8页 / 共16页
第9页 / 共16页
第10页 / 共16页
亲,该文档总共16页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
Java笔试题(可多选)1. 下面哪些是Thread类的方法(ABD)A start()B run()C exit()DgetPriority()2. 下面关于类的说法正确的是(A)A 继承自 ThrowableB SerialableC该类实现了 Throwable接口D该类是一个公共类3. 下面程序的运行结果是(false)Stri ng str1 = hello;Stri ng str2 = he + new Stri ng(llo);=str2);4. 下列说法正确的有(C)B. constructor必须与class同名,但方法不能与class同名C. constructor在一个对象被new时执行D. 个 class 只能定义一个 constructortrue )5. 指针在任何情况下都可进行 , =, =,=运算?6. 下面程序的运行结果:(B)public static void mai n( Stri ng args) Thread t = new Thread() public void run() pong();();pin g);static void pon g() po ng);A pingpongB pongpingC pingpong 和 pongping 者E有可能D都不输出7. 下列属于关系型数据库的是(AE)D Mo ngoDBtrue )false )A. OracleE MySql C IMS8. GC(垃圾回收器)线程是否为守护线程?(9. volatile关键字是否能保证线程安全?(10. 下列说法正确的是(AC)A LinkedList 继承自 ListB AbstractSet 继承自 SetC HashSet 继承自 AbstractSetD WeakMap继承自 HashMap11. 存在使i + 1 i 的数吗?( 存在12. 的数据类型是(B)A floatB doubleC FloatD Double13. 下面哪个流类属于面向字符的输入流(A )ABufferedWriterBFilel nputStreamCObject In putStreamD In putStreamReader14. Java接口的修饰符可以为(CDA privateB protectedC finalabstract15. 不通过构造函数也能创建对象吗(A)A是B否扩充几次(A)B)16. ArrayList list = new ArrayList(20);中的 listA 0B 1C 2D 317. 下面哪些是对称加密算法(ABA DES B AES C DSA D RSA18. 新建一个流对象,下面哪个选项的代码是错误的?(A) new BufferedWriter(new FileWriter();B) new BufferedReader(new FilelnputStream();C) new GZIPOutputStream(new FileOutputStream();D new ObjectInputStream(new FileInputStream();19. 下面程序能正常运行吗(yes )public class NULL public static void haha()haha);public static void main(String args) (NULL )n ull).haha();20. 下面程序的运行结果是什么()class HelloA public HelloA() HelloA); Im A class); static static A); public class HelloB exte nds HelloA public HelloB() HelloB); Im B class); static static B); public static void main(String args) new HelloB();Static AStatic BHello AI m A classHelp BI m B Class21. getCustomerlnfo()方法如下,try中可以捕获三种类型的异常,如果在该方法运行中产生了一个lOException,将会输出什么结果(A)public void getCustomerInfo() try 下面代码的运行结果为:(C)import .*;import .*;public class foopublic static void ma in (Stri ng args)Stri ng s;s= + s);A代码得到编译,并输出“ s二”B代码得到编译,并输出“ s=null ”C由于String s没有初始化,代码不能编译通过D代码得到编译,但捕获到NullPointException 异常23. 5 + 2);的输出结果应该是(A)B7A 52C2D524. 指出下列程序运行的结果(B)public class Example String str = new Strin g(good);char ch = a, b, c ;public static void mai n( Stri ng args) Example ex = new Example。;+ and );public void change(String str, char ch) str = test ok;ch0 = g;Agood and abcB、good and gbcCtest ok and abcDtest ok and gbc25. 要从文件中读出第10个字节到变量c中,下列哪个方法适合?( ABA FilelnputStream in二new FilelnputStream(); (9); int c=();B File In putStream in二new File In putStream(”); (10); intc=();C FileInputStream in二new FileInputStream(”); int c=();D RandomAccessFile in二new RandomAccessFile(”); (9); int c=();26. 下列哪种异常是检查型异常,需要在编写程序时声明(C)A NullPoi nterExceptio nB ClassCastExceptio nC FileNotFo un dExcepti onD In dexOutOfBo un dsExceptio n27. 下面的方法,当输入为2的时候返回值是多少?(D)public static int getValue(i nt i) int result = 0;switch (i) case 1:result = result + i;case 2:result = result + i * 2;case 3:result = result + i * 3;retur n result;BCD 10Shape和Circle两个类到文件时,下面哪个字A 024Switch 也需要 Break28. 选项中哪一行代码可以替换题目中阅读 的定义。在序列化一个 Circle 的对象circle 段会被保存到文件中?( B)class Shape public String n ame;class Circle exte nds Shape impleme nts Serializableprivate float radius;tran sie nt int color;public static Stri ng type = Circle;A n ameB radiusC colorD type父类为继承Serializable 接口,其成员不能被序列化,静态变量和transient 修饰的不能被序列化30.下面是People和Child类的定义和构造方法,每个构造方法都输 出编号。在执行new Child(mike)的时候都有哪些构造方法被顺序 调用?请选择输出结果 (D )class People Stri ng n ame;public People() public People(Str ing n ame) =n ame;class Child exte nds People People father;public Child(Stri ng n ame) =n ame;father = new People (n ame + :F);public Child() A 312 32432D 132
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号