d)
<%@ page language=\
137. 在J2EE中,对于 当前JSP执行活动停止,并且清除缓冲区,把请求传递到URL上 b) 相当于include动作,把请求传递到URL上 c) 当前JSP执行活动停止,并且清除缓冲区,重定向到URL上,但不把请求传递到URL上 d) 相当于include指令 在J2EE中,在提供名为sock的套接字实例的前提下,为了获取通过套接字进行通信的输出流,你可以编写()。 a) 138. sock.accept(); b) sock.getDataOutputStream(); c) sock.getOutputStream(); d) new DataOutputStream(sock); 139. .在J2EE中,为了使得在客户端可以接收用户在控制台上的键盘输入,且把键盘输入发 送到服务器,同时还要接收服务器给客户端的反馈,需要构造三个用于输入输出的对象变量,以下代码符合要求的是()。其中clientSocket是一个Socket类的对象。 a) BufferedRead br1 = System.in; BufferedRead br2 = new BufferedReader(clientSocket.getInputStream())); PrintStream ps = new PrintStream(clientSocket.getOutputStream()); b) BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in)); BufferedReader br2 = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); PrintStream ps = new PrintStream(clientSocket.getOutputStream()); c) BufferedRead br1 = new InputStreamReader(System.in); BufferedReader br2 = new InputStreamReader(clientSocket.getInputStream()); PrintStream ps = new PrintStream(clientSocket.getOutputStream()); d) BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in)); BufferedReader br2 = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); PrintStream ps = clientSocket.getOutputStream(); 140..在Java中,下列代码将输出()。(JAVA模式应用) 1. public class integerequals 2. { 3. public static void main (String args[]) 4. { 5. Integer a= new Integer(3); 6. 7. 8. } 9. } a) 编译器将显示第7行有错误 b) 程序编译并打印true c) 程序编译并打印false d) 程序编译但在第7行引起了一个运行期意外 141. 下面代码中,横线上应该填写什么内容? public class MyCircle { private double radius; public void setRadius(double radius) Integer b= new Integer(3); System.out.println(a==b); _________________; } } A. this.radius = radius B. radius = radius C. radius = this.radius D. MyCircle.radius = radius 142. 下面是一个将数据写入二进制文件的程序,横线上应该填写什么内容? int id = 828000; ___________ dout = new ______________(new FileOutputStream(\dout.___________; dout.close(); A. DataOutputStream DataOutputStream writeInt(id) B. DataOutputStream DataOutputStream write(id) C. FileWriter FileWriter writeInt(id) D. FileWriter FileWriter write(id) 143. 下面这段代码的功能是什么? File folder = new File(\ String[] l = folder.list(); for(int i=0; i System.out.println(l[i]); A. 不显示任何内容 B. 在屏幕上显示C盘根目录下的所有文件夹 C. 在屏幕上显示C盘根目录下的所有文件 D. 在屏幕上显示C盘根目录下的所有文件和文件夹 144. 下面的程序将一个Account对象保存到文件中,横线上应该填写什么内容? class Account ______________ { private long id; private double value; public static void main(String[] args) throws IOException { } FileOutputStream fout = new FileOutputStream(\ObjectOutputStream oout = new ObjectOutputStream(fout); Account account = new Account(1, 0.5); oout.__________(account); oout.close(); fout.close(); public Account(long aID, double aValue) { } id = aID; value = aValue; } A. (空白) writeObject B. implements Serializable writeObject C. (空白) writeData D. implements Serializable writeData 答案:B 145. 源代码文件Geometric中有下面的代码,请找出不符合Java编码规范的地方。 public class GeometricObject { private String name = “GeometricObject”; public String getName() { } } return name; public void setName(String aName) { name = aName; } public class Rectangle extends GeometricObject{ private double width; private double height; public Rectangle(double aWidth, double aHeight) { } setName(“Rectangle”); width = aWidth; height = aHeight; public double getArea() { return width*height; } } A. 类GeometricObject中变量name不能在声明时赋值,应该放到一个构造函数中赋值 B. 文件名与类名不一致,应该将文件名改为GeometricObject.java C. 类Rectangle中的实例变量width和height应该放到一行声明,以缩短代码行数 D. 类GeometricObject应放到文件GeometricObject.java中,类Rectangle应该放到文件Rectangle.java中 146.下列各种java类的定义,那种是错误的 ? A. class MyClass{ private int Val; public int getVal(){ return Val; } } B. class MyClass{ private static int Val; public int getVal(){ return Val; } } C. class MyClass{ private int Val; public static int getVal(){ return Val; } } D. class MyClass{ private static int Val; public static int getVal(){ return Val; } } 147.给定下面的代码片段: public class ex1 { public void Test() { try { method(); } catch (ArrayIndexOutOfBoundsException e){ System.out.println(\ } catch(Exception e) { System.out.println(\} finally{ } System.out.println(\ } public void method() { //... } public static void main(String[] args) { ex1 obj=new ex1(); obj.Test(); } } 如果函数method正常运行并返回,会显示下面的哪些信息?(选择1项) A)Hello World B)Exception1 C)Exception2 D)Thank you! 填空题(题库量 50) 901.JDBC驱动程序的种类有(四种) 902.执行同构的SQL,用(CallableStatement) 903.执行异构的SQL, 用(Statement) 904. 调用存储进程或函数用(PreparedStatement) 905. 11.如果要限制某个查询语句返回的最多的记录数,可以通过调用Statement的方法 (setMaxRows)来实现。 906. 15.接口RowSet继承了接口ResultSet。可以调用RowSet中的方法 (update)来填充其数据区。 907. DataSource是(Factory)类型,可以调用(getConnection)获得数据库连接。 908. 在Java Web开发中,跟踪客户状态的手段可通过session 和(Cookie)