What are the differences between unchecked exception, checked exception, and errors?
Answer Posted / 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 |
Post New Answer View All Answers
What is a text string?
Can string be considered as a keyword?
Name few java.lang classes introduced with java 8 ?
Give differences between Quicksort & Mergesort. When should these sorts be used and what is their running time?
What is the use of jtable?
What is an arraylist in java?
what are three ways in which a thread can enter the waiting state? : Java thread
How can a gui component handle its own events?
What do the thread?class methods run() and start() do?
What are latest features introduced with java 8?
Explain notify() method of object class ?
What is double in java?
What is the use of set in java?
What is difference between final and immutable?
What is constructor chaining in java?