在程序的下画线处应填入的选项是()。 public class Test { public static void main(String args[]){ Test t=new Test; Thread tt=new Thread(t); tt.start; } public void run{ for(int i=0;i<5;i++){ System.OUt.println("i="+i); } } }
A. implements Runnable
B. extends Thread
C. implements Thread
D. extends Runnable
查看答案
下列程序的输出结果是()。 public class Test{ public static void main(String[]args){ int[]array=(2,4,6,8,lO); int size=6; int result =-1: try{ for(int i=0;i(size 8L&result= = -1;) if(array[i]= =20)result=i: } catch(ArithmeticException e){ System.out.println("Catch- - -l"); } catch(ArraylndexOutOfBoundsException e){ System.out.println("Catch- - -2"); } catch(Exception e){ System.out.println("Catch- - -3");) } }
A. Catch- - -1
B. Catch- - -2
Catch- - -3
D. 以上都不对
执行下列程序之后,变量n的值为()。 public class Exam{ public static void main(String[]args){ int y=2; int z=3: int n=4: n=n+-y*z/n; System.out.println(n); } }
A. 3
B. -l
C. -l2
D. -3
用鼠标单击菜单项(Menultem)产生的事件是()。
A. MenuEvent
B. ActionEvent
C. KeyEvent
D. MouseEvent
下列可以获得构件前景色的方法是()。
A. getsize
B. getForeground
C. getBaekground
D. paint