下列程序的输出结果为()。 public class MainClass { public static void main(String args[]) { int i, s = 0; int num[] = { 11, 22, 33, 44, 55, 66, 77, 88, 99 }; for (i = 0; i < num.length; i++) if (num[i] % 3 == 0) s += num[i]; System.out.println(s); } }
第1题
A. 第2行编译出错
B. 第4行编译出错
C. 编译时产生错误
D. 编译时没有产生错误,运行时发生异常
第2题
classMultiCatch{
publicstaticvoidmain(Stringargs[]){
try{
inta=args.length;
intb=44/a;
intc[]={2,6};
c[44]=100;
System.out.println("b="+b);
}catch(ArithmeticExceptione){
System.out.println("除0异常");
}catch(ArrayIndexOutOfBoundsExceptione){
System.out.println("数组超越边界异常");
}finally{
System.out.println("程序执行结束");
}
}
}
运行结果是:
第3题
B. 运行出错
C. 输出结果为 null
D. 编译错误
第4题
A.11 12 13 201 201
B.101 102 103 201 201
C.11 12 13 201 202
D.10 10 10 201 201
第5题
A.11 12 13 201 201
B.101 102 103 201 201
C.11 12 13 201 202
D.10 10 10 201 201
第6题
A.打印5个0
B.编译出错,数组ar[]必须初始化
C.编译出错,Mine应声明为abstract
D.出现IndexOutOfBoundes的例外
第7题
A.②④
B.①③
C.②
D.以上都不对
第8题
{
int var;
Waiter(double var)
{
this.var = (int)var;
}
Waiter(int var)
{
this("Class");
}
Waiter(String s)
{
this();
System.out.println(s);
}
Waiter()
{
System.out.println("Java");
}
public static void main(String[] args)
{
Waiter t = new Waiter(1);
}
}
第9题
A.20
B.30
C.40
D.50
第10题
A.编译未通过
B.编译通过,但运行错误
C.可以运行,但有错误
D.以上都不对
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!