答案:C
(29)当启动Applet程序时,首先调用的方法是
A)stop() B)init() C)start() D)destroy()
答案:B
(30)下列关于线程优先级的说法中,正确的是
A)线程的优先级是不能改变的
B)线程的优先级是在创建线程时设置的
C)在创建线程后的任何时候都可以设置
D)B和C
答案:C
(31)当浏览器重新返回Applet所在页面时,将调用Applet类的方法是
A)start() B)init() C)stop() D)destroy()
答案:A
(32)按照Java的标识符命名规范,下列表示一个类的标识符正确的是
A)Helloworld B)HelloWorld C)helloworld D)helloWorld
答案:B
(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行
答案: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.put.println("Hello");
}
}
}
A) sleep(1000)
InterruptedException
B) sleep(1000)
InterruptedException
C) Thread.sleep(1000)
RuntimeException
D) Thread.sleep(1000)
InterruptedException
答案:D
(35)阅读下列代码后
public class Person{
int arr[]=new int[10];
public static void main(String args[]){
System.out.println(arr[1]);
}
}
正确的说法是
A) 编译时将产生错误 B) 编译时正确,运行时将产生错误
C) 输出零 D) 输出空
答案:A