A)new BufferedWriter(new FileWriter(\ B)new BufferedReader(new FileInputStream(\ C)new GZIPOutputStream(new FileOutputStream(\ D)new ObjectInputStream(new FileInputStream(\
18. Java的集合框架中重要的接口java.util.Collection定义了许多方法。选项中哪个方法
不是Collection接口所定义的?( C ) A)int size()
B)boolean containsAll(Collection c) C)compareTo(Object obj) D)boolean remove(Object obj)
19. 一个线程在任何时刻都处于某种线程状态(thread state),例如运行状态、阻塞状态、
就绪状态等。一个线程可以由选项中的哪种线程状态直接到达运行状态?( D ) A)死亡状态
B)阻塞状态(对象lock池内) C)阻塞状态(对象wait池内) D)就绪状态
20. 选项中哪一行代码可以替换题目中//add code here而不产生编译错误?( A ) public abstract class MyClass {
public int constInt = 5; //add code here public void method() { } }
A)public abstract void method(int a); B)value = value + 5; (未定义该变量) C)public int method();
D)public abstract void anotherMethod() {}
21. File类是IO包中唯一表示磁盘文件信息的对象,它定义了一些与平台无关的方法
来操纵文件。通过调用File类提供的各种方法,我们能够创建、删除文件、重命名文件、
判断文件的读写权限及是否存在,设置和查询文件的最近修改时间等。下面的代码片段实现 的是什么功能?( B ) File file = new File(\ if (file.exists()) { file.delete(); } A)创建C:\\test.dat。 B) 删除C:\\test.dat。
C) 打开C:\\test.dat文件输出流。
D) 移动C:\\test.dat
22. 阅读Shape和Circle两个类的定义。在序列化一个Circle的对象circle到文件时,
下面哪个字段会被保存到文件中? ( B ) class Shape {
public String name; }
class Circle extends Shape implements Serializable{ private float radius; transient int color;
public static String type = \ } A)name
B)radius (私有的) C)color D)type
***23. 下面是People和Child类的定义和构造方法,每个构造方法都输出编号。在执行new
Child(\的时候都有哪些构造方法被顺序调用?请选择输出结果 ( D ) class People { String name;
public People() { System.out.print(1); } public People(String name) { System.out.print(2); this.name = name; } }
class Child extends People { People father;
public Child(String name) { System.out.print(3); this.name = name;
father = new People(name + \ }
public Child(){ System.out.print(4); } }
A)312 B) 32 C) 432 D) 132
24. 下面哪个选项中的代码没有定义内部类,或者错误的定义了内部类? ( C ) A)public Class Line { int length;
Class Point {//内部类代码}

