- 1、本文档共55页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
[工学]面向对象程序JAVA程序设计复习题_练习题有答案0
信管071班复习资料~~Java程序设计
一、单项选择题
1.指出正确的表达式()
A. byte = 128;
B. Boolean = null;
C. long l = 0xfffL;
D. double = 0.9239d;
2.指出下列程序运行的结果 public class Example{ String str=new String(good); char[]ch={a,b,c}; public static void main(String args[]){ Example ex=new Example(); ex.change(ex.str,ex.ch); System.out.print(ex.str+ and ); Sytem.out.print(ex.ch); } public void change(String str,char ch[]){ str=test ok; ch[0]=g; } }
A.good and abc
B.good and gbc
C.test ok and abc
D.test ok and gbc
3.给出下面代码: public class Person{ static int arr[] = new int[10]; public static void main(String a[]) { System.out.println(arr[1]); } } 那个语句是正确的?
A. 编译时将产生错误; B. 编译时正确,运行时将产生错误;
C .输出零; D. 输出空。
4.哪个关键字可以对对象加互斥锁?
A. transient B. synchronized C.serialize D.static
5.下列代码哪几行会出错: 1) public void modify() { 2) int I, j, k; 3) I = 100; 4) while ( I 0 ) { 5) j = I * 2; 6) System.out.println ( The value of j is + j ); 7) k = k + 1; 8) I--; 9) } 10}
A. line 4 B. line 6 C. line 7 D. line 8
6.MAX_LENGTH是int型public成员变量, 变量值保持为常量100,用简短语句定义这个变量。
A. public int MAX_LENGTH=100;
B. final int MAX_LENGTH=100;
C. final public int MAX_LENGTH=100;
D. public final int MAX_LENGTH=1007.给出下面代码: 1) class Parent { 2) private String name; 3) public Parent(){} 4) } 5) class Child extends Parent { 6) private String department; 7) public Child() {} 8) public String getValue(){ return name; } 9) public static void main(String arg[]) { 10) Parent p = new Parent(); 11) } 12)} 那些行将引起错误? A. 第3行 B. 第6行 C. 第7行 D. 第8行8.给出下面代码段 1) public class Test { 2) int m, n; 3) public Test() {} 4) public Test(int a) { m=a; } 5) public static void main(String arg[]) { 6) Test t1,t2; 7) int j,k; 8) j = 0; k = 0; 9) t1 = new Test(); 10) t2 = new Test(j,k); 11) } 12)} 哪行将引起一
文档评论(0)