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
How do you compare objects in java?
What is an object’s lock and which object’s have locks?
do I need to use synchronized on setvalue(int)? : Java thread
What are thread safe functions?
How to display all the prime numbers between 1 and 100
What is meant by final class?
Tell us something about different types of casting?
What is yield () in java?
What are bind parameters?
What is singleton class and how can we make a class singleton?
What type of language is java?
What is the static block?
Can a lock be acquired on a class in java programming?
Do I need java on my computer?
FOR EXAMPLE WE R HAVING TWO LIST ELEMENTS ..BOTH LISTS CONTAINS ID,NAME,PLACE ..I NEED TO COMPARE BOTH IDS IN TWO LISTS,IF ID'S R SAME MEANS WE HAVE ADD THE DETAILS(LIKE NAME,PLACE) TO MAP...HOW IS POSSIBLE ?CAN ANY ONE SUGGEST?