题目内容

下列程序的输出结果是()。 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

下面程序段的输出结果为()。 public class Test { int a,b; Test { a=100; b=200: } Test(int X,int y) { a=x: b=y; } public static void main(String args[]) { Test bjl=new Test(12,45); System.OUt.println("a="+Objl.a+"b="+Objl. b); Test Obj2=new Test; System.out.println("fl="+Obj2.a+"b="+Obj2. b); } }

A. a=100 b=200 a=12 b=45
B. a=12 b=45a=100 b=200
C. a=12 b=200 a=100 b=45
D. a=100 b=45 a=12 b=200

答案查题题库