What are the differences between unchecked exception, checked exception, and errors?
Answers were Sorted based on User's Feedback
Answer / nashiinformaticssolutions
• An Unchecked exception inherits from RuntimeException (which extends from exception). The JVM treats RuntimeException differently as there is no requirement for the application code to deal with them explicitly.
• A checked exception inherits from the exception class. The client code has to handle the checked exceptions either in a try-catch clause or has to be thrown for the super-class to catch the same. A checked exception thrown by a lower class (sub-class) enforces a contract on the invoking class (super-class) to catch or throw it.
• Errors (members of the error family) usually appear for more serious problems, such as OutOfMemoryError (OOM), that may not be so easy to handle.
Is This Answer Correct ? | 0 Yes | 0 No |
• An Unchecked exception inherits from RuntimeException (which extends from exception). The JVM treats RuntimeException differently as there is no requirement for the application code to deal with them explicitly.
• A checked exception inherits from the exception class. The client code has to handle the checked exceptions either in a try-catch clause or has to be thrown for the super-class to catch the same. A checked exception thrown by a lower class (sub-class) enforces a contract on the invoking class (super-class) to catch or throw it.
• Errors (members of the error family) usually appear for more serious problems, such as OutOfMemoryError (OOM), that may not be so easy to handle.
Is This Answer Correct ? | 0 Yes | 0 No |
What is the immediate superclass of Menu?
What is update method and when it is called?
What is method overloading and method overriding?
what is the difference between the "protected and default" modifiers?
public class Test { public static void main(String ar[]) { Integer a = 10; Integer b =10; Integer c = 145; Integer d = 145; System.out.println(a==b); System.out.println(c==d); } }
List primitive java types?
Difference between ‘>>’ and ‘>>>’ operators in java?
What is “try and catch” in java
What is connection class in java?
Why do we use bufferedreader?
Is binary a low level language?
Can we create our own daemon thread?