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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

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

吉首大学java试题库.docx

1、吉首大学java试题库一、选择题(15个,每个2分,共30分)1下面哪个是java里的关键字A booleanB IntegerC protectD array2有如下定义:int x;则x的取值范围为:A -231 到231-1B -216到216-1C -232到232D -216到2163String s = new String( Computer ); if( s = Computer ) System.out.println( Equal A ); if( s.equals( Computer ) ) System.out.println( Equal B );有关上面这段代码执行

2、后的结果正确的说法是:A 只输出一行字符串” Equal A” B只输出一行字符串” Equal B”C输出两行字符串” Equal A”和” Equal A”D 代码不会编译成功,因为字符串类String不支持”= =”操作符 4下列有关数组不正确的定义方法为: A intx=1,2,3;B int x=1,2,3,1,2,3;C int x3=1,2,3;D int x=new int31,2,3;5interface A int x = 0; A() x= 5; A(int s) x = s; 有关这段代码正确的说明是:A 这是一段合法的代码,并且能够正确执行;B 这段代码编译失败,因为

3、对于接口只能有一个构造函数;C 这段代码编译失败,因为接口不能有构造函数;D 这段代码编译失败,因为不需要写缺省构造函数,因为编译器会帮你产生。6下面关于抽象方法正确的定义方法为 A abstract void Test();B abstract void Test() C static abstract void Test();D final abstract void Test();71. public class Test 2. static int x; 3. static public void main(String args) 4. x = x + 1; 5. System.ou

4、t.println(Value is + x); 6. 7. 有关这段代码正确的说法是:A 代码编译失败,因为变量x没有初始化就使用B 代码编译正确,但是在第5行抛出NullPointerException;C 代码编译成功,并且输出:Value is 1D 代码编译失败,因为main函数没有正确定义。81. public class Test 2. public static void main(String args) 3. print(); 4. 5. 6. public static void print() 7. System.out.println(Test); 8. 9. 10.

5、 public void print() 11. System.out.println(Another Test); 12 13. 有关这段代码正确的说法是:A 代码编译成功,并且输出:Test;B 代码编译失败,编译器报错:在静态得方法中调用非静态得方法print();C 代码编译失败,编译器报重复定义方法print();D 把第10行的print()函数的返回类型从void改为int就可以编译成功9class Father int i=0; Father(String s) i=10; class child extends Father Child(String s) i=20; pub

6、lic static void main(String args) Child c=new Child(hello); System.out.println(i); 上述代码运行后i的输出结果是:A 编译错误B 运行错误C 10D 20101. class FinalTest 2. final int q; 3. final int w = 0; 4. 5. FinalTest() 6. q = 1; 7. 8. 9. FinalTest(int x) 10. q = x; 11. 12. 有关这段代码正确的说法是:A 代码编译失败,因为一个类不能有超过1个构造函数B 代码编译失败,因为第6行

7、和第10行企图给声明为final的变量赋值 C 代码编译没有任何错误.D 代码编译失败,因为第2行有声明为final的变量没有赋初值.111. class Test 2. public static void main(String args) 3. aMethod(); 4. 5. 6. static void aMethod() 7. try 8. System.out.println(abcd); 9. return; 10. finally 11. System.out.println(1234); 12. 13. 14.有关上述这段代码,正确的说法是:A 第9行有异常抛出B abcd

8、 1234C abcdD 代码编译失败,因为在第10行没有与try相对应的catch语句。12.上述图片所对应的applet所采用的布局管理方式是:A CardLayoutB null LayoutC BorderLayoutD FlowLayout13. 下面哪个方法会开始一个线程的执行:A init()B start()C run()D resume()14. 如果文件系统上还没有Ran.test,当你运行下面代码后下面选项中正确的说法是import java.io.*; class Ran public static void main(String args) throws IOExc

9、eption RandomAccessFile out = new RandomAccessFile(Ran.test, rw); out.writeBytes(Ninotchka); A 代码不会编译,因为RandomAccessFile没有实现writeBytes()方法;B 代码编译成功,但是在运行的时候抛出IOException,因为Ran.test文件不存在;C 代码编译成功,但是在运行之后,在新产生的Ran.test文件中没有任何内容;D 代码编译成功,并且在运行后,在新产生的Ran.test文件中显示内容“Ninotchka”。15. 下面程序的打印结果是:import java

10、.io.*;public class Test public static void main(String args) throws Exception RandomAccessFile file1 = new RandomAccessFile(test.txt,rw); file1.writeBoolean(true); file1.writeInt(123456); file1.writeInt(7890); file1.writeLong(100000); file1.writeInt(777); file1.seek(5); System.out.println(file1.read

11、Int(); A 123456B 7890C 100000D 777二、填空题:(20个空,每空1分,共20分)1java中提供了4种用于控制访问权限的符号,分别是_,_,_,_.2java中提供了两种用于多态的机制 _,_.3java中用_关键字指明继承关系,用_关键字指明对接口的实现。4一个线程进入停止状态的两个原因是_和在该线程上调用了stop方法。5我们可以用关键字_来对对象加互斥锁.6java中,JFrame缺省使用的布局管理策略是:_,JApplet缺省使用的布局管理策略是_7java中线程的生命周期有新生,就绪状态,_,_,死亡状态。8java系统中用于读取文件中的字节数据的字节

12、文件输入类是_,用于向文件中写入字节数据的字节文件输出类是_,用于读取文件的字符数据的类是_,用于向文件写入字符数据的类是_.9java语言一般提供三种通讯方式:URL通讯方式,_,_.三、程序阅读题(6小题,每题5分,共30分)1class Tester int var; Tester(double var) this.var = (int)var; Tester(int var) this(hello); Tester(String s) this(); System.out.println(s); Tester() System.out.println(good-bye); public

13、 static void main(String args) Tester t = new Tester(5); 输出结果为2class Tree class Pine extends Tree class Oak extends Tree public class Forest public static void main( String args ) Tree tree = new Pine(); if( tree instanceof Pine ) System.out.println( Pine ); if( tree instanceof Tree ) System.out.pri

14、ntln( Tree ); if( tree instanceof Oak ) System.out.println( Oak ); else System.out.println( Oops ); 这段代码执行后的输出结果为3class Happy static StringBuffer sb1=new StringBuffer(A); static StringBuffer sb1=new StringBuffer(B); public static void main(String args) Happy h=new Happy(); h.methodA(sb1,sb2); System

15、.out.println(sb1+,+sb2); public void methodA(StringBuffer x,StringBuffer y) y.append(x); x=y; 这段代码执行后的输出结果为4试写出下面这个程序的执行结果.class ExceptionTest static String a = 123, abc, null; public static void main (String args) for (int i = 0; i 3; i+) try int x = Integer.parseInt(ai); System.out.println( Result

16、: + x); catch(NullPointerException e) System.out.println(error null:); catch (NumberFormatException e) System.out.println(error:abc ); finallySystem.out.println (In + i +th loopn); /end for 5试分析下面这个程序执行的顺序,将给出注释的六行代码的执行先后次序写出来。class Insect int i = 9; int j; Insect() / 1 prt(i = + i + , j = + j); j =

17、 39; static int x1 = /2 prt(static Insect.x1 initialized); static int prt(String s) System.out.println(s); return 47; public class Beetle extends Insect int k = prt(Beetle.k initialized); /3 Beetle() /4 prt(k = + k); prt(j = + j); static int x2 = prt(static Beetle.x2 initialized); /5 static int prt(

18、String s) System.out.println(s); return 63; public static void main(String args) prt(Beetle constructor); /6 Beetle b = new Beetle(); /:6class Sleep extends Thread public Sleep(String name) super(name); start(); public void run() try Thread.sleep(3000); catch(InterruptedException e) System.out.print

19、ln(this.getName()+睡眠时间被吵醒); return; System.out.println(this.getName()+睡觉睡到自然醒); public class Waiter extends Thread private Sleep sleeper; public Waiter(String name,Sleep sleeper) super(name); this.sleeper = sleeper; start(); public void run() try sleeper.join(); catch(InterruptedException e) System.

20、out.println(等待+sleeper.getName()+的+this.getName()+继续.); System.out.println(over); public static void main(String args) Sleep s1=new Sleep(Sleep#1); Sleep s2=new Sleep(Sleep#2); Waiter w1=new Waiter(Waiter#1,s1); Waiter w2=new Waiter(Waiter#2,s2); s2.interrupt(); 上面程序运行后的结果是:四、程序编写题(2题,每题10分,共20分)1、编写一个具有继承关系的java程序,要求如下:a. 必须有this或者super的使用;b. 必须在程序中体现出方法的重载和覆盖.2、编写一个java程序,实现拷贝文件”test.txt”中的所有内容到”test1.txt”中.

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

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