题目内容

能单独和finally语句一起使用的块是( )。

A. try
B. catch
C. throw
D. throws

查看答案
更多问题

下面程序的执行结果是( )。public class Test {public static void main(String[] args) {new Test().test();}public void test(){try{System.out.print("try");}catch(ArrayIndexOutOfBoundsException e){System.out.print("catch1");}catch(Exception e){System.out.print("catch2");}finally{System.out.println("finally");}}}

A. try finally
B. try catch1 finally
C. try catch2 finally
D. finally

下面程序抛出的RuntimeException异常是( )。public static void main(String[] args) {System.out.println(1/0);}}

A. NumberFormatException
B. Exception
C. ArrayIndexOutOfBoundsException
D. ArithmeticException

下列类中在多重catch中同时使用时,( )异常类应该最后列出。

A. NumberFormatException
B. Exception
C. ArrayIndexOutOfBoundsException
D. ArithmeticException

下面程序会抛出的RuntimeException异常是( )。public class Test {public static void main(String args[]){String s="abc";System.out.println(s.charAt(3));}}

A. NumberFormatException
B. Exception
C. StringIndexOutOfBoundsException
D. 以上都不对

答案查题题库