1 / 11
文档名称:

java程序设计试题a.doc

格式:doc   页数:11页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

java程序设计试题a.doc

上传人:cdsqbyl 2015/8/22 文件大小:0 KB

下载得到文件列表

java程序设计试题a.doc

相关文档

文档介绍

文档介绍:(每题3分,共30分)
,哪项是Java语言的关键字?( D )

,哪项是不合法的Java标识符?( B )
D.$100
,哪项赋值语句不能通过编译?( D )
a = 123; a = 'A'; c = 123; c = '123';
?( A )
D.
?( A )

,哪项是正确的赋值语句?( D )
a = ; a = ; a = null; s = null;
( B )。


( C )。
public class Test {
public static void main(String[] args) {
int a = 1;
int b = 2;
int c = 3;
int d = 4;
int result = (a > b) && (c++ < d) ? b:c;
(result);
}
}

( D )。
public class Test {
static String[] arr = new String[10];
public static void main(String[] args) {
(arr[1]);
}
}

,运行产生异常
,运行输出0
,运行输出null
,其中包含一个名为Student的public类,为了成功编译该文件需要满足以下哪个条件?( C )




(每题5分,共50分)
以下各题中的程序:如果你认为程序不能通过编译,请回答:【编译错误】;如果你认为程序能够通过编译,但运行时会出现异常,请回答:【编译正确,运行时产生异常】;如果你认为程序能够正确编译并正常运行,请写出程序的运行结果。
1.
class Test {
public static void main(String[] args) {
int i = 0;
while(true) {
i++;
if(i > 10) {
break;
}
}
("i=" + i);
}
}
输出:i=11
1.
class Test {
public static void main(String[] args) {
String s = "我爱Java";
(());
}
}
输出:6
2.
class Test {
public static void add3(Integer i) {
int val = ();
val += 3;
i=new Integer(val);
}
public static void main(String args[]) {
Integer i = new Integer(2);
add3(i);
(());
}
}
输出:2
3.
class Test {
public static void main(String[] args) {
String s = "Java";
hello(s);
(s);
}
public s