用catch(Exception exception)语句可以捕

题目

用catch(Exception exception)语句可以捕获所有异常和错误。

参考答案和解析
正确答案:错误
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

下面哪些类型的实例对象可以通过throw语句抛出()。

  • A、Event
  • B、Object
  • C、Throwable
  • D、RuntimeException
  • E、Exception

正确答案:C,D,E

第2题:

public class Test {  public static void aMethod() throws Exception {  try {  throw new Exception(); } finally {  System.out.println(“finally”);  }  }  public static void main(String args[]) {  try {  aMethod();  } catch (Exception e) {  System.out.println(“exception”);  }  System.out.println(“finished”);  }  }  What is the result?()  

  • A、 finally
  • B、 exception finished
  • C、 finally exception finished
  • D、 Compilation fails.

正确答案:C

第3题:

在catch语句中列出异常类型时FormatException异常应列在Exception异常的()。


正确答案:前面

第4题:

public static void main(String[] args) {  try {  args=null;  args[0] = “test”;  System.out.println(args[0]);  } catch (Exception ex) {  System.out.println(”Exception”);  } catch (NullPointerException npe) {  System.out.println(”NullPointerException”);  }  }  What is the result?() 

  • A、 test
  • B、 Exception
  • C、 Compilation fails.
  • D、 NullPointerException

正确答案:C

第5题:

public class ExceptionTest {   class TestException extends Exception {}   public void runTest () throws TestException {}   public void test () /* Point X*/ {   runTest ();   }   }   At point X on line 4, which code can be added to make the code compile?()  

  • A、 Throws Exception.
  • B、 Catch (Exception e).
  • C、 Throws RuntimeException.
  • D、 Catch (TestException e).
  • E、 No code is necessary.

正确答案:B

第6题:

static void test() {  try {  String x=null;  System.out.print(x.toString() +“ “);  }  finally { System.out.print(“finally “); }  }  public static void main(String[] args) {  try { test(); }  catch (Exception ex) { System.out.print(”exception “); }  }  What is the result?() 

  • A、 null
  • B、 finally
  • C、 null finally
  • D、 Compilation fails.
  • E、 finally exception

正确答案:E

第7题:

1. public class Exception Test {  2. class TestException extends Exception {}  3. public void runTest() throws TestException {}  4. public void test() /* Point X */ {  5. runTest();  6. }  7. }  At Point X on line 4, which code is necessary to make the code compile?()  

  • A、 No code is necessary.
  • B、 throws Exception
  • C、 catch ( Exception e )
  • D、 throws RuntimeException
  • E、 catch ( TestException e)

正确答案:B

第8题:

在catch语句中列举异常类型时,DivideByZeroException异常应列在Exception异常的()。(填前面或后面)


正确答案:前面

第9题:

try {  int x = 0;  int y = 5 / x;  } catch (Exception e) {  System.out.println(“Exception”);  } catch (ArithmeticException ae) {  System.out.println(“Arithmetic Exception”);  }  System.out.println(“finished”);  What is the result?()  

  • A、 finished
  • B、 Exception
  • C、 Compilation fails.
  • D、 Arithmetic Exception

正确答案:D

第10题:

try {  if ((new Object))(.equals((new Object()))) {  System.out.println(“equal”);  }else{  System.out.println(“not equal”);  }  }catch (Exception e) {  System.out.println(“exception”);  }   What is the result? () 

  • A、 equal
  • B、 not equal
  • C、 exception
  • D、 Compilation fails.

正确答案:D

更多相关问题