ImageVerifierCode 换一换
格式:DOCX , 页数:25 ,大小:25.54KB ,
资源ID:16352146      下载积分:2 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/16352146.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(附录A综合复习题newWord下载.docx)为本站会员(b****3)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

附录A综合复习题newWord下载.docx

1、5) public void go() 6) ArrayList al = new ArrayList(); 7) getList(al);8) 9) /getList方法的定义10) _11) _12) _13) 5、 在以下程序的横线处填写代码,使得该代码总是输出10,202) public class Demo implements _3) private int i;4) public Demo(int i)5) this.i=i;7) public static void main (String args) 8) _9) v.add(new Demo(20);10) v.add(n

2、ew Demo(10);11) Collections.sort(v);12) System.out.println (v);13) 14) public int compareTo(Object o)15) _16) return this.i-d.i;17) 18) public String toString()19) _20) 21) 6、 给定以下的代码:1) public class Person 2) private String name;3) public Person(String name)4) this.name = name;5) 6) public boolean

3、equals(Person p) 7) return p.name.equals(this.name);9) 以下哪句描述是正确的? ( )A. 该类中的equals方法没有正确重写Object类中的equals方法. B. 因为第5行的私有属性name不能被访问,所以编译错误. C. 为了使基于hash的数据结构能正常工作,该类必须实现hashCode方法. D. 当向一个java.util.Set 集合中添加Person类的对象,第四行的equals方法将阻止添加重复元素.7、 给定以下的代码:22) public class Point implements Comparable 23)

4、 private int x, y;24) public Point (int x, int y)25) this.x=x;26) this.y=y;27) 28) public int getX()return x; 29) public int getY()return y;30) public String toString() 31) return ;32) 33) _34) 在横线处填写代码使该类能够通过编译?8、 给定以下没有使用泛型的方法:1) public static int sum(List list) 2) int sum = 0;3) for(Iterator iter

5、 = list.iterator(); iter.hasNext();) 4) int i = (Integer)iter.next().intValue();5) sum += i;6) 7) return sum;8) 修改以上代码,使该类使用泛型机制来完成相同功能,又可以避免不安全的警告?_9、 给定以下代码:2) public class WrappedString 3) private String s;4) public WrappedString(String s)this.s = s;5) public static void main(String args) 6) Hash

6、Set hs = new HashSet7) WrappedString ws1 = new WrappedString(aardvark8) WrappedString ws2 = new WrappedString(9) String s1 = new String(10) String s2 = new String(11) hs.add(ws1); hs.add(ws2); hs.add(s1); hs.add(s2);12) System.out.println(hs.size();14) 运行的结果是什么?A. 0 B. 1 C. 2 D. 3 E. 4 F. 编译失败G. 运行时

7、抛出一个异常.10、 以下哪些不是java.sql包里的类或者接口?A. ConnectionB. PreparedStatementC. DataSourceD. StatementE. ResultSet11、 给定一下代码:2) public class SortDemo 3) public static void main(String args) 4) HashMap hm = new HashMap 5) hm.put(10, abc6) hm.put(50, gdf7) hm.put(30, fds8) Collections.sort(hm);9) hm.put(20, jfd

8、10) Collections.reverse(hm);11) System.out.println(hm);12) 13) A. 50=gdf, 20=jfd, 10=abc, 30=fds B. 10=abc, 20=jfd, 30=fds, 50=gdf C. 10=abc, 30=fds, 50=gdf, 20=jfd D. 编译错误E. 运行时抛出一个异常12、 假设数据库连接成功,conn是一个数据库连接对象,以下哪两段代码是正确查询数据库中一个名叫Student表里的所有数据的代码?A. Statement stmt=conn.getStatement();stmt.execut

9、eQuery(Select * from StudentB. PreparedStatement pstmt=conn.prepareStatement(pstmt.executeQuery();C. PreparedStatement pstmt=conn.createPrepareStatement(D. Statement stmt=conn.createStatement();13、 在以下的代码的横线处填写代码,使之可以完成序列化和反序列化的功能:1) import java.io.*;2) public class Point implements Serializable3) p

10、ublic Integer x,y;4) public Point (Integer x,Integer y)5) this.x=x;6) this.y=y;7) 8) private void write(ObjectOutputStream oos)throws Exception9) _10) _11) 12) private void read(ObjectInputStream ois)throws Exception13) _14) _15) 16) 14、 给定以下代码:2) class Flower implements Serializable 3) int price=5;

11、4) 5) class rose extends Food 6) int price=6;7) 8) class YellowRose extends Fruit9) int price =4;10) 11) public class SerialDemo12) public static void main(String args)13) try14) YellowRose yr=new YellowRose();15) YellowRose yr2=new YellowRose();16) FileOutputStream fos=new FileOutputStream (file.se

12、r17) ObjectOutputStream oos=new ObjectOutputStream(fos);18) oos.writeObject(yr);19) FileInputStream fis=new FileInputStream (20) ObjectInputStream ois=new ObjectInputStream(fis);21) yr2=(YellowRose)ois.readObject();22) System.out.println(yr2.price + yr2.price + yr2.price); 23) catch(Exception ex)24)

13、 ex.printStackTrace();25) 26) 27) 结果是什么?A. 15B. 18C. 1215、 给定以下的代码片段:1) Object myObjs = new Integer(30), new String(10), new Integer(20), new Boolean(false);2) Arrays.sort(myObjs);3) for(Object o: myObjs)4) System.out.print(o.toString()+ 5) A. 因为1行的错误导致编译错误B. 因为2行的错误导致编译错误C. 运行时在2行出现一个ClassCastExcep

14、tion异常D. 运行时在3行出现一个ClassCastException异常E. 输出:0 10 20 3016、 给定以下的代码:2) class MyClass3) String s;4) MyClass(String s)5) this.s=s;8) public class Demo 9) public static void main(String args) 10) HashSet hs = new HashSet();11) MyClass mc1 = new MyClass(hello12) MyClass mc2 = new MyClass(13) String s1 =

15、new String(14) String s2 = new String(15) hs.add(mc1);16) hs.add(mc2);17) hs.add(s1);18) hs.add(s2);19) System.out.println(hs.size();21) A. 0B. 1C. 2D. 3E. 417、 以下哪三段代码可以通过编译(选三项)( )A. public void method(List list) list.add(fooB. public void method(ListObject o = list;C. public void method(ListStrin

16、g s = list.get(0);D. public void method(Listlist = new ArrayListE. public void method(List18、 给定以下代码:2) public class HashSetDemo 4) HashSet5) Integer i1 = new Integer(25);6) Integer i2 = new Integer(26);7) hs.add(i1);8) hs.add(i1);9) hs.add(i2);10) System.out.print(hs.size() + t11) hs.remove(i1);12)

17、 System.out.print(hs.size() + 13) i2 = new Integer(27);14) hs.remove(i2);15) System.out.print(hs.size();16) 17) A. 编译错误B. 运行时抛出一个异常C. 2 1 0D. 2 1 1E. 3 2 1F. 3 2 219、 给定以下代码:2) interface A3) void x();4) 5) class B implements A6) public void x()8) public void y()11) class C extends B12) public void x

18、()14) 15) public class Limited16) public static void main (String args) 17) List list = new ArrayList18) list.add(new B();19) list.add(new C();20) for(A a :21) a.x();22) a.y();23) 24) 25) A. 这段代码运行没有输出C. 第11行导致编译错误D. 第17行导致编译错误E. 第20行导致编译错误F. 第22行导致编译错误20、 给定以下代码:2) public class TreeSetDemo 4) TreeS

19、et ts = new TreeSet5) ts.add(30);6) ts.add(10);7) ts.add(60);8) Iterator it=ts.iterator();9) while(it.hasNext()10) Integer n=(Integer)it.next();11) System.out.print (n + 12) B. 运行抛出一个异常C. 10 30 60D. 30 10 60 21、 要创建一个泛型类GenericClass,而该泛型类的参数必须实现Comparable接口,下面哪一个GenericClass泛型类的定义可以通过编译?A. class GenericClassT extends ComparableT t;B. class GenericClass T implements Comparable C. class GenericClass T t;D. class GenericClass T implements Comparable22、 给定以下的代码4) ArrayList str = new ArrayList5) str.add(student6) str.add(7) str.add(world8) str.

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1