2011计算机等级考试二级Java模拟试题6
2011计算机等级考试二级Java模拟试题631.当浏览器重新返回 Applet 所在页面时,将调用 Applet 类的方法是____。
A、start()
B、init()
C、stop()
D、destroy()
A B C D
32.按照 Java 的标识符命名规范,下列表示一个类的标识符正确的是____。
A、Helloworld
B、HelloWorld
C、helloworld
D、helloWorld
A B C D
33.下列代码中,将引起一个编译错误的行是____。
1)public class Test{
2) int m,n;
3) public Test(){}
4) public Test(int a){m=a;}
5) public static void main(String args[]){
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) }
A、第3行
B、第5行
C、第6行
D、第10行
A B C D
34.下列程序的功能是在监控台上每隔一秒钟显示一个字符串“Hello!”,能够填写在程序中下划线位置,使程序完整并能正确运行的语句是____。
public class Test implements Runnable{
public static void main(String args[]){
Test t=new Test();
Thread tt=new Thread(t);
tt.start();
}
public void run(){
for(;;){
try{
____;
}catch(____ e){}
System.out.println("Hello");
}
}
}
A、sleep(1000)
InterruptedException
B、t.sleep(1000)
InterruptedException
C、Thread.sleep(1000)
RuntimeException
D、Thread.sleep(1000)
InterruptedException
A B C D
35.阅读下列代码后
public class Person{
int arr[]=new int;
public static void main(String args[]){
System.out.println(arr);
}
}
正确的说法是
A、编译时将产生错误
B、编译时正确,运行时将产生错误
C、输出零
D、输出空
A B C D
页:
[1]