更多“简述RuntimeException和Exception的区别。”相关问题
  • 第1题:

    关于checked/uncheckedexception,下列哪些说法是正确的:

    A.继承java.lang.Error的类属于checkedexception

    B.checked异常继承java.lang.Exception类

    C.unchecked异常继承java.lang.RuntimeException类

    D.NullPointerException,IllegalArgumentException属于uncheckedexception


    正确答案:BCD

  • 第2题:

    error和exception有什么区别?


    正确答案: error 表示恢复不是不可能但很困难的情况下的一种严重问题。比如说内存溢出。不可能指望程序能处理这样的情况。  
    exception 表示一种设计或实现问题。也就是说,它表示如果程序运行正常,从不会发生的情况。

  • 第3题:

    简述Error和Exception的区别。


    正确答案: E.rror:指的是JVM错误,这个时候的程序并没有执行,无法处理。
    E.xception:指的是程序中出现的错误信息,可以进行异常处理,主要关心Exception。

  • 第4题:

    class ThreadExcept implements Runnable {   public void run() { throw new RuntimeException("exception "); }   public static void main(String [] args) {   new Thread(new ThreadExcept()).start();   try {   int x = Integer.parseInt(args[0]);   Thread.sleep(x);   System.out.print("main ");    } catch (Exception e) { }      }  }   和命令行:  java ThreadExcept 1000    哪一个是结果?()  

    • A、 main
    • B、 编译失败
    • C、 代码运行,但没有输出
    • D、 main java.lang.RuntimeException:exception

    正确答案:D

  • 第5题:

    下面有关JAVA异常类的描述,说法错误的是()。

    • A、异常的继承结构:基类为Throwable,Error和Exception继承Throwable,RuntimeException和IOException等继承Exception
    • B、非RuntimeException一般是外部错误,其必须被 try{}catch语句块所捕获
    • C、Error类体系描述了Java运行系统中的内部错误以及资源耗尽的情形,Error不需要捕捉
    • D、RuntimeException体系包括错误的类型转换、数组越界访问和试图访问空指针等等,必须被 try{}catch语句块所捕获

    正确答案:D

  • 第6题:

    public class X {  public static void main(String [] args) {  try {  badMethod();  System.out.print(“A”);  }  catch (Exception ex) {  System.out.print(“B”);  }  finally {  System.out.print(“C”);  }  System.out.print(“D”);  }  public static void badMethod() {  throw new RuntimeException();  }  }  What is the result? () 

    • A、 AB
    • B、 BC
    • C、 ABC
    • D、 BCD
    • E、 Compilation fails.

    正确答案:D

  • 第7题:

    问答题
    Error和Exception有是区别?

    正确答案: error表示恢复不是不可能,但是很困难,exception表示一种实际或实现问题,它表示程序运行正常不可以发生的。
    解析: 暂无解析

  • 第8题:

    问答题
    Error与Exception有什么区别?

    正确答案: Error表示系统级的错误和程序不必处理的异常;
    Exception表示需要捕捉或者需要程序进行处理的异常。
    解析: 暂无解析

  • 第9题:

    单选题
    static void test() throws RuntimeException {  try {  System.out.print(”test “);  throw new RuntimeException();  }  catch (Exception ex) { System.out.print(”exception “); }  }  public static void main(String[] args) {  try { test(); }  catch (RuntimeException ex) { System.out.print(”runtime “); }  System.out.print(”end “);  }  What is the result?()
    A

     test end

    B

     Compilation fails.

    C

     test runtime end

    D

     test exception end

    E

     A Throwable is thrown by main at runtime.


    正确答案: C
    解析: 暂无解析

  • 第10题:

    单选题
    11.classA {  12. public void process() { System.out.print(”A “); } }  13. class B extends A {  14. public void process() throws RuntimeException {  15. super.process();  16. if (true) throw new RuntimeException();  17. System.out.print(“B”); }}  18. public static void main(String[] args) {  19. try { ((A)new B()).process(); }  20. catch (Exception e) { System.out.print(”Exception “); }  21. }  What is the result?()
    A

     Exception

    B

     A Exception

    C

     A Exception B

    D

     A B Exception

    E

     Compilation fails because of an error in line 14.

    F

     Compilation fails because of an error in line 19.


    正确答案: F
    解析: 暂无解析

  • 第11题:

    单选题
    class ThreadExcept implements Runnable {   public void run() { throw new RuntimeException("exception "); }   public static void main(String [] args) {   new Thread(new ThreadExcept()).start();   try {   int x = Integer.parseInt(args[0]);   Thread.sleep(x);   System.out.print("main ");    } catch (Exception e) { }      }  }   和命令行:  java ThreadExcept 1000    哪一个是结果?()
    A

     main

    B

     编译失败

    C

     代码运行,但没有输出

    D

     main java.lang.RuntimeException:exception


    正确答案: B
    解析: 暂无解析

  • 第12题:

    问答题
    简述Error和Exception的区别。

    正确答案: E.rror:指的是JVM错误,这个时候的程序并没有执行,无法处理。
    E.xception:指的是程序中出现的错误信息,可以进行异常处理,主要关心Exception。
    解析: 暂无解析

  • 第13题:

    static void test() throws RuntimeException {  try {  System.out.print(”test “);  throw new RuntimeException();  }  catch (Exception ex) { System.out.print(”exception “); }  }  public static void main(String[] args) {  try { test(); }  catch (RuntimeException ex) { System.out.print(”runtime “); }  System.out.print(”end “);  }  What is the result?() 

    • A、 test end
    • B、 Compilation fails.
    • C、 test runtime end
    • D、 test exception end
    • E、 A Throwable is thrown by main at runtime.

    正确答案:D

  • 第14题:

    Error与Exception有什么区别?


    正确答案: Error表示系统级的错误和程序不必处理的异常;
    Exception表示需要捕捉或者需要程序进行处理的异常。

  • 第15题:

    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

  • 第16题:

    Error和Exception有是区别?


    正确答案: error表示恢复不是不可能,但是很困难,exception表示一种实际或实现问题,它表示程序运行正常不可以发生的。

  • 第17题:

    public class X {  public static void main(String [] args) {  try {  badMethod();  System.out.print(“A”);  }  catch (RuntimeException ex) {  System.out.print(“B”);  }  catch (Exception ex1) {  System.out.print(“C”);  }   finally {  System.out.print(“D”);  }  System.out.print(“E”);  }  public static void badMethod() {  throw new RuntimeException();  }  }  What is the result?()  

    • A、 BD
    • B、 BCD
    • C、 BDE
    • D、 BCDE
    • E、 ABCDE
    • F、 Compilation fails.

    正确答案:C

  • 第18题:

    单选题
    public class X {  public static void main(String [] args) {  try {  badMethod();  System.out.print(“A”);  }  catch (RuntimeException ex) {  System.out.print(“B”);  }  catch (Exception ex1) {  System.out.print(“C”);  }   finally {  System.out.print(“D”);  }  System.out.print(“E”);  }  public static void badMethod() {  throw new RuntimeException();  }  }  What is the result?()
    A

     BD

    B

     BCD

    C

     BDE

    D

     BCDE

    E

     ABCDE

    F

     Compilation fails.


    正确答案: D
    解析: 暂无解析

  • 第19题:

    单选题
    现有:  class ThreadExcept implements Runnable  {  public void run()  {  throw new RuntimeException("exception ");  }  public static void main(Stri_ng  []  args)  {  new  Thread (new  ThreadExcept()).start();  try  {  int x=Integer.parselnt (args [0]);  Thread. sleep (x);  System.out.print("main");  } catch (Exception e)  {  }  }  }  和命令行:  java ThreadExcept l000     哪一个是结果?()
    A

    main

    B

    编译失败

    C

    main java.lang.RuntimeException: exception

    D

    代码运行,但没有输出


    正确答案: A
    解析: 暂无解析

  • 第20题:

    单选题
    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.


    正确答案: E
    解析: 暂无解析

  • 第21题:

    单选题
    What is wrong with the following code?()   class MyException extends Exception {}   public class Qb4ab {   public void foo() {  try {  bar();  } finally {  baz();   } catch (MyException e) {}  }   public void bar() throws MyException {   throw new MyException();  }   public void baz() throws RuntimeException {   throw new RuntimeException();   }   }
    A

    Since the method foo() does not catch the exception generated by the method baz(), it must      declare the RuntimeException in its throws clause.

    B

    A try block cannot be followed by both a catch and a finally block.

    C

    An empty catch block is not allowed.

    D

    A catch block cannot follow a finally block.

    E

    A finally block must always follow one or more catch blocks.


    正确答案: B
    解析: 暂无解析

  • 第22题:

    问答题
    error和exception有什么区别?

    正确答案: error 表示恢复不是不可能但很困难的情况下的一种严重问题。比如说内存溢出。不可能指望程序能处理这样的情况。  
    exception 表示一种设计或实现问题。也就是说,它表示如果程序运行正常,从不会发生的情况。
    解析: 暂无解析

  • 第23题:

    单选题
    下面有关JAVA异常类的描述,说法错误的是()。
    A

    异常的继承结构:基类为Throwable,Error和Exception继承Throwable,RuntimeException和IOException等继承Exception

    B

    非RuntimeException一般是外部错误,其必须被 try{}catch语句块所捕获

    C

    Error类体系描述了Java运行系统中的内部错误以及资源耗尽的情形,Error不需要捕捉

    D

    RuntimeException体系包括错误的类型转换、数组越界访问和试图访问空指针等等,必须被 try{}catch语句块所捕获


    正确答案: A
    解析: 暂无解析