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 difference between integer parseint and integer valueof?
What are heterogeneous objects?
Can we overload the constructors?
How large is a boolean?
Give few difference between constructor and method?
How many boolean functions are there?
Explain the difference between scrollbar and scrollpane?
Which collection is ordered in java?
What is entry in java?
What are the major drawbacks of external iteration?
what is the use of reference variable
What is byte code and why is it important to java’s use for internet programming?