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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

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

大学期末考试 Java题库.docx

1、大学期末考试 Java题库1.下面程序的运行结果是( )。public class E3 public static void main(String args) String s=大大; char a=s.charAt(2),b=s.charAt(4); System.out.print(a); System.out.println(b); 2.下面程序的运行结果是( )。import java.util.*;public class LinkedListExample public static void main(String args) LinkedList linkedlist =

2、new LinkedList(); linkedlist.add(new Integer(1); linkedlist.add(new Integer(2); linkedlist.add(new Integer(3); linkedlist.add(new Integer(4); linkedlist.add(new Integer(5); System.out.println(The original contents of the linkedlist is: ); System.out.println(linkedlist); linkedlist.add(2,hello); link

3、edlist.addFirst(First); linkedlist.addLast(Last); System.out.println(After adding elements,the linkedlist is: ); System.out.println(linkedlist); 答:3.下面程序的运行结果是( )。public class TestArray public static void main(String args) int i, j; int a = 5, 9, 6, 8, 7 ; for (i = 0; i a.length-1; i+) int k = i; fo

4、r (j = i; j a.length; j+) if (aj ak) k = j; int temp = ai; ai = ak; ak = temp; for (i = 0; i a.length; i+) System.out.print(ai + ); System.out.println(); 4.下面程序的运行结果是( )。public class TryCatchFinally static void Proc(int sel) try if (sel = 0) System.out.println(no Exception ); return; else if (sel =

5、1) int i = 0; int j = 4 / i; catch (ArithmeticException e) System.out.println(Catch ); catch (Exception e) System.out.println(Will not be executed); finally System.out.println(finally); public static void main(String args) Proc(0); Proc(1); 5.下面程序的运行结果是( )。public class welcomeTest public static void

6、 main(String args) String s, s1 = ; char c; s = wELCOME; for (int i = 0; i = a & c = z) s1 = s1 + Character.toUpperCase(c); else s1 = s1 + Character.toLowerCase(c); System.out.println(s1); 6.下面程序的运行结果是( )。public class arrTest public static void main(String args) int i, j; int a = 2, 1, 4, 8; for (i

7、= 0; i a.length - 1; i+) int k = i; for (j = i; j a.length; j+) if (aj ak) k = j; int temp = ai; ai = ak; ak = temp; for (i = 0; i a.length; i+) System.out.print(ai + ); System.out.println(); 7.下面程序的运行结果是( true,false)。public class StringTest public static void main(String args) String s1 = new Strin

8、g(abcde); String s2 = new String(abcde); boolean b1 = s1.equals(s2); boolean b2 = s1 = s2; System.out.print(b1 + , + b2); 8.下面程序运行时,若输入10,则输出结果是( )。public class test public static void main(String args) throws IOException BufferedReader buf = new BufferedReader( new InputStreamReader(System.in); whi

9、le (true) String str = buf.readLine(); if (str.equals(quit) break; int x = Integer.parseInt(str); System.out.println(x * x); System.out.println(“OK”); 9.下面程序的运行结果是( )。public class T public static void main(String args) Set set = new HashSet(); set.add(new Integer(10); set.add(new Integer(5); set.add

10、(new Integer(15); set.add(new Integer(5); set.add(new Integer(10); System.out.println(size = + set.size(); Iterator it = set.iterator(); while (it.hasNext() System.out.print(it.next() + ); 10.下面程序的运行结果是( )。public class A class Dog private String name; private int age; public int step; Dog(String s,

11、int a) name = s; age = a; step = 0; public void run(Dog fast) fast.step+; public static void main(String args) A a = new A(); Dog dog = a.new Dog(Tom, 3); dog.step = 25; dog.run(dog); System.out.println(dog.step); 11.下面程序的运行结果是( )。class A int x=1, y=2; double add() return x+y; class B extends A int

12、x=10, y=20; double add() return super.x + super.y; class Takecare public static void main(String args) A a = new A(); B b = new B(); System.out.println(a.add=+a.add(); System.out.println(b.add=+b.add(); 12.下面程序的运行结果是( )。for (int i = 0; i 5; i+) switch (i) default: System.out.print(defaultt); case 0:

13、 System.out.print(zerot); i+; break; case 1: System.out.print(onet); case 2: System.out.print(twot); i+; 13.下面程序的运行结果是( )。public class Example String str = new String(good); char ch = a, b, c; public void change(String str, char ch) str = test ok; ch0 = g; public static void main(String args) Exampl

14、e example = new Example(); example.change(example.str, example.ch); System.out.print(example.str + and ); System.out.print(example.ch); 14.下面程序的运行结果是( )。class A public String Show(D obj) return (A and D); public String Show(A obj) return (A and A); class B extends A public String Show(B obj) return

15、(B and B); public String Show(A obj) return (B and A); class C extends B public String Show(C obj) return (C and C); public String Show(B obj) return (C and B); class D extends B public String Show(D obj) return (D and D); public String Show(B obj) return (D and B); public class main public static v

16、oid main(String args) A a1 = new A(); A a2 = new B(); B b = new B(); C c = new C(); D d = new D(); System.out.println(a1.Show(b); System.out.println(a1.Show(c); System.out.println(a1.Show(d); System.out.println(a2.Show(b); System.out.println(a2.Show(c); System.out.println(a2.Show(d); System.out.prin

17、tln(b.Show(b); System.out.println(b.Show(c); System.out.println(b.Show(d); 15.下面程序的运行结果是( )。public class Example extends TT public static void main(String args) Example t = new Example(Tom); public Example(String s) super(s); System.out.println(How do you do?); public Example() this(I am Tom); class

18、 TT public TT() System.out.println(What a pleasure!); public TT(String s) this(); System.out.println(I am + s); 16.下面程序的运行结果是( )。public class Example public static void main(String args) for (int i = 0; i 2; i+) resume: for (int j = 0; j 3; j+) for (int k = 0; k A) y=爱; z=情; else y=我; z=她; System.ou

19、t.println( +x+y+z); 19.下面程序的运行结果是( )。class TT public TT() System.out.println(What a peasure!); public TT(String s) this(); System.out.println(I am + s); public class Example extends TT public static void main(String args) Example example = new Example(); public Example(String s) super(s); System.out

20、.println(How do youo do?); public Example() this(I am Tom); 20.下面程序的运行结果是( )。public class Example public static void main(String args) int count = 0; for (int i = 0; i 3; i+) resume: for (int j = 0; j 4; j+) for (int k = 0; k 5; k+) +count; if (i = 1 & j = 2 & k = 3) break resume; System.out.println

21、(tcount= + count); 21.下面程序的运行结果是( )。public class A class Dog private String name; private int age; public int step; Dog(String s, int a) name = s; age = a; step = 0; public void run(Dog fast) fast.step-; public static void main(String args) A a = new A(); Dog dog = a.new Dog(Tom, 3); dog.step = 30;

22、dog.run(dog); System.out.println(dog.step); 22.下面程序的运行结果是( )。import java.io.*;public class TestFile public static void main(String args) throws Exception BufferedReader br = new BufferedReader(new InputStreamReader(System.in); BufferedWriter bw = new BufferedWriter(new FileWriter(input.txt); String

23、s; while (true) System.out.print(请输入一个字符串: ); System.out.flush(); s = br.readLine(); if (s.length() = 0) break; bw.write(s); bw.newLine(); bw.close(); 23.下面程序的运行结果是( )。class A public String Show(D obj) return (A and D); public String Show(A obj) return (A and A); class B extends A public String Show

24、(B obj) return (B and B); public String Show(A obj) return (B and A); class C extends B public String Show(C obj) return (C and C); public String Show(B obj) return (C and B); class D extends B public String Show(D obj) return (D and D); public String Show(B obj) return (D and B); public class main

25、public static void main(String args) A a1 = new A(); A a2 = new B(); B b = new B(); C c = new C(); D d = new D(); System.out.println(a1.Show(b); System.out.println(a1.Show(c); System.out.println(a1.Show(d); System.out.println(a2.Show(b); System.out.println(a2.Show(c); System.out.println(a2.Show(d); System.out

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

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