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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

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

java程序阅读.docx

1、java 程序阅读三、阅读程序,写出程序的输出结果(每题5分,共20分)1、class A private int privateVar; A(int _privateVar) privateVar=_privateVar;boolean isEqualTo(A anotherA) if(this.privateVar = anotherA.privateVar) return true; else return false; public class B public static void main(String args) A a = new A(1); A b = new A(2);

2、System.out.println(a.isEqualTo(b); 程序的输出结果为:_false_ 2、class A double f(double x, double y) return x * y; class B extends A double f(double x, double y) return x + y; public class Test public static void main(String args) B obj = new B(); System.out.println(The program output is + obj.f(4, 6); 程序的输出结

3、果为:_ The program output is 10_3、public class Unchecked public static void main(String args) try method(); catch (Exception e) System.out.println(A); finally System.out.println(B); static void method() try wrench(); System.out.println(C); catch (ArithmeticException e) System.out.println(D); finally S

4、ystem.out.println(E); System.out.println(F); static void wrench() throw new NullPointerException(); 程序的输出结果为:EAB4、public class Test public static void main(String args) int x; int a = 0, 0, 0, 0, 0, 0 ; calculate(a, a5); System.out.println(the value of a0 is + a0); System.out.println(the value is a5

5、 is + a5); static int calculate(int x, int y) for (int i = 1; i x.length; i+) if (y 10 ); public static void main(String arg) int i=10; Test t= new Test(); t.printValue(i); 输出将是什么? CA. 8 B. 9 C. 10 D. 1130. 给出下面的代码片断 1 String str = null; 2 if (str != null) & (str.length() 10) 3 System.out.println(mo

6、re than 10); 4 5 else if (str != null) & (str.length() =0; j-) if(1 j) & i) != 0) System.out.print(1); else System.out.print(0); System.out.println();/换行 A)00000000000000000000000000000001B)00000000000000000000000000000010C)00000000000000000000000000001111D)00000000000000000000000000000000【答案】B7. 应用

7、程序的main方法中有以下语句,则输出的结果是 ( )。int x=122,33,55,678,-987; int max=x0; for(int i=1;imax) max=xi; System.out.println(max);A) 678 B) 122 C) -987 D) 33 【答案】A8.下列语句序列执行后,k 的值是( )。 int x=2, y=5, k=0; switch( x%y ) case 0: k=x+y; break; case 1: k=x-y; break; case 2: k=x*y; break; default: k=x/y; break; System.

8、out.println(k);A) 2 B) 5 C) 10 D) 0 【答案】C9. 下面的程序输出的结果是( )public class A implements B public static void main(String args) int i; A c1 = new A(); i= c1.k; System.out.println(i=+i); interface B int k = 10; A) i=0 B) i=10 C) 程序有编译错误 D) i=true【答案】B10应用程序的main方法中有以下语句,则输出的结果是 ( )。int b=1, 2, 3, 4,5, 6,7

9、; int sum=0; for(int i=0;ib.length;i+) for(int j=0;jbi.length;j+) sum+=bij; System.out.println(sum=+sum);A) 28 B)6 C) 9 D) 13 【答案】A12.编译和运行下面的应用程序,并在命令行界面输入12345,则回车后屏幕输出的结果是( ).public class A public static void main(String args) throws IOException BufferedReader buf=new BufferedReader( new InputStr

10、eamReader(System.in); String str=buf.readLine(); int x=Integer.parseInt(str); System.out.println(x/100); A) 45 B)5 C) 123 D) 12345【答案】C13.下面的程序段执行后输出的结果是( )。 StringBuffer buf=new StringBuffer(Beijing2008); buf.insert(7,); System.out.println(buf.toString();A)Beijing2008 B)Beijing2008 C) Beijing2008D)

11、 Beijing#2008 【答案】A14. 下面的程序编译运行后输出的结果是( )。public class A implements Runnable public static void main(String argv) A a = new A(); Thread t = new Thread(a); t.start(); public void run() while(true) try Thread.currentThread().sleep(1000); catch(InterruptedException e) System.out.println(e.toString(); System.out.println(looping while); A) 在屏幕上重复输出looping while。B) 在屏幕上输出一次looping while。C) 没有结果输出。 D) 以上说法都错误。【答案】A

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

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