2024年Java笔试题答案

上传人:壹****1 文档编号:569099510 上传时间:2024-03-19 格式:DOC 页数:15 大小:35.50KB
返回 下载 相关 举报
2024年Java笔试题答案_第1页
第1页 / 共15页
2024年Java笔试题答案_第2页
第2页 / 共15页
2024年Java笔试题答案_第3页
第3页 / 共15页
2024年Java笔试题答案_第4页
第4页 / 共15页
2024年Java笔试题答案_第5页
第5页 / 共15页
点击查看更多>>
资源描述

《2024年Java笔试题答案》由会员分享,可在线阅读,更多相关《2024年Java笔试题答案(15页珍藏版)》请在金锄头文库上搜索。

1、班级:_ 学号:_ 姓名:_Java 笔试题(可多项选择)1. 下面哪些是Thread类的措施( ABD)A start() B run() C exit() D getPriority()2. 下面有关java.lang.Exception类的说法正确的是(A)A 继承自Throwable B Serialable C 该类实现了Throwable 接口D 该类是一个公共类3. 下面程序的运行成果是( false )String str1 = hello;String str2 = he + new String(llo);System.err.println(str1 = str2);4.

2、下列说法正确的有( C)A class中的constructor不可省略B constructor必须与class同名,但措施不能与class同名C constructor在一个对象被new时执行D一个class只能定义一个constructor5. 指针在任何情况下都可进行, =, =, =运算?( true )6. 下面程序的运行成果:(B)public static void main(String args) Thread t = new Thread() public void run() pong(); ; t.run(); System.out.print(ping); stat

3、ic void pong() System.out.print(pong);A pingpong B pongping C pingpong和pongping都有也许 D 都不输出7. 下列属于关系型数据库的是(AB)A. Oracle B MySql C IMS D MongoDB8. GC(垃圾回收器)线程是否为守护线程?( true )9. volatile核心字是否能确保线程安全?( false )10. 下列说法正确的是(AC)A LinkedList继承自ListB AbstractSet继承自SetC HashSet继承自AbstractSetD WeakMap继承自HashMa

4、p11. 存在使i + 1 i的数吗?( 存在 )12. 0.6332的数据类型是(B)A float B double C Float D Double13. 下面哪个流类属于面对字符的输入流(A )ABufferedWriterBFileInputStreamCObjectInputStreamD InputStreamReader 14. Java接口的修饰符能够为(CD)A private B protected C final D abstract15. 不通过结构函数也能创建对象吗(A)A 是 B 否16. ArrayList list = new ArrayList(20);中的

5、list扩充几次(A)A 0 B 1 C 2 D 317. 下面哪些是对称加密算法(AB)A DES B AES C DSA D RSA18.新建一个流对象,下面哪个选项的代码是错误的?(B)A)new BufferedWriter(new FileWriter(a.txt);B)new BufferedReader(new FileInputStream(a.dat);C)new GZIPOutputStream(new FileOutputStream(a.zip);D)new ObjectInputStream(new FileInputStream(a.dat);19. 下面程序能正常

6、运行吗( yes )public class NULL public static void haha() System.out.println(haha); public static void main(String args) (NULL)null).haha(); 20. 下面程序的运行成果是什么()class HelloA public HelloA() System.out.println(HelloA); System.out.println(Im A class); static System.out.println(static A); public class HelloB

7、 extends HelloA public HelloB() System.out.println(HelloB); System.out.println(Im B class); static System.out.println(static B); public static void main(String args) new HelloB(); Static A Static BHello AIm A classHelp BIm B Class21.getCustomerInfo()措施如下,try中能够捕捉三种类型的异常,假如在该措施运行中产生了一个IOException,将会输

8、出什么成果(A)public void getCustomerInfo() try / do something that may cause an Exception catch (java.io.FileNotFoundException ex) System.out.print(FileNotFoundException!); catch (java.io.IOException ex) System.out.print(IOException!); catch (java.lang.Exception ex) System.out.print(Exception!); AIOExcep

9、tion!B IOException!Exception!C FileNotFoundException!IOException!D FileNotFoundException!IOException!Exception!22. 下面代码的运行成果为:(C)import java.io.*;import java.util.*;public class foo public static void main (String args) String s; System.out.println(s= + s); A代码得到编译,并输出“s=”B代码得到编译,并输出“s=null”C因为Strin

10、g s没有初始化,代码不能编译通过D代码得到编译,但捕捉到NullPointException异常23. System.out.println(5 + 2);的输出成果应当是(A)。A52 B7 C2 D524.指出下列程序运行的成果(B)public class Example String str = new String(good); char ch = a, b, c ; public static void main(String args) Example ex = new Example(); ex.change(ex.str, ex.ch); System.out.print(

11、ex.str + and ); System.out.print(ex.ch); public void change(String str, char ch) str = test ok; ch0 = g; A、good and abcB、good and gbcC、test ok and abcD、test ok and gbc25.要从文献file.dat中读出第10个字节到变量c中,下列哪个措施适合?(AB)AFileInputStream in=new FileInputStream(file.dat); in.skip(9); int c=in.read();BFileInputS

12、tream in=new FileInputStream(file.dat); in.skip(10); int c=in.read();CFileInputStream in=new FileInputStream(file.dat); int c=in.read();DRandomAccessFile in=new RandomAccessFile(file.dat); in.skip(9); int c=in.readByte();26.下列哪种异常是检查型异常,需要在编写程序时申明(C)A NullPointerException B ClassCastException C FileNotFoundException D IndexOutOfBoundsException27. 下面的措施,当输入为2的时候返回值是多少?(D)public static int getValue(int i) int result = 0; switch (i)

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 高等教育 > 习题/试题

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号