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 floor math?
Can we have try block without catch block?
What is static block?
explain the difference between jdk and jvm?
What is Enum in Java?
What are different exception types exceptions available in java ?
What are the methods available in a class?
Can I learn java without any programming experience?
What do you understand by synchronization?
Difference between concurrent hashmap and hashtable and collections
What is set and get methods in java?
What is Garbage Collection in Java
What is an object class?
How do you override a method in java?
Is null keyword in java?