What are the differences between unchecked exception, checked exception, and errors?
Answer Posted / hr@tgksolutions.com
• 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 the difference between notify and notifyall method?
Is ruby built on java?
Do I need to import java.lang package any time? Why?
What are the types of arrays in java?
What is java oops?
What is functional interface in javatpoint?
Can you access the private method from outside the class?
Explain the importance of throws keyword in java?
What is a locale?
What is an example of declaration?
What is java objectoutputstream?
What are the different types of multitasking?
What is integer parseint?
What are the parts of methodology?
how its run?