A.编译时报错
B.正确运行,输出012
C.正确运行,输出123
D.正确运行,输出0123
第1题
A、1
B、2
C、2.5
D、3
第2题
publicclassTest{
publicstaticintaMethod(inti)throwsException{
try{
returni/10;
}catch(Exceptionex){
thrownewException("exceptioninaaMothod");
}finally{
System.out.print("finally");
}
}
publicstaticvoidmain(String[]args){
try{
aMethod(0);
}catch(Exceptionex){
System.out.print("exceptioninmain");
}
System.out.print("finished");
}
}
A、finallyexceptioninmainfinished
B、exceptioninmainfinally
C、finallyfinished
D、finallyexceptioninmainfinished
第3题
classParent1{
Parent1(Strings){
System.out.println(s);
}
}
classParent2extendsParent1{
Parent2(){
System.out.println("parent2");
}
}
publicclassChildextendsParent2{
publicstaticvoidmain(String[]args){
Childchild=newChild();
}
}
A、编译错误:没有找到构造方法Child()
B、编译错误:没有找到构造方法Parent1()
C、正确运行,没有输出值
D、正确运行,输出结果为:parent2
第4题
A.不能通过编译
B.通过编译,输出为:AB
C.通过编译,输出为:B
D.通过编译,输出为:A
第5题
publicclassTest{
publicTest(){}
staticvoidprint(ArrayListal){
al.add(2);
al=newArrayList();
al.add(3);
al.add(4);
}
publicstaticvoidmain(String[]args){
Testtest=newTest();
ArrayListal=newArrayList();
al.add(1);
print(al);
System.out.println(al.get(1));
}
}
A、1
B、2
C、3
D、4
第6题
A.0
B.1
C.2
D.3
第7题
A.Java
B.Language
C.Test
D.编译出错
第8题
A.Java
B.Language
C.Test
D.编译出错
第9题
A.Java
B.Language
C.Test
D.编译出错
第10题
A.Java
B.Language
C.Test
D.编译时出错
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!