What are the differences between unchecked exception, checked exception, and errors?

Answers were Sorted based on User's Feedback



What are the differences between unchecked exception, checked exception, and errors?..

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

What are the differences between unchecked exception, checked exception, and errors?..

Answer / 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

More Core Java Interview Questions

What is the difference between integer parseint and integer valueof?

0 Answers  


What are heterogeneous objects?

0 Answers  


Can we overload the constructors?

0 Answers  


How large is a boolean?

0 Answers  


Give few difference between constructor and method?

0 Answers  






How many boolean functions are there?

0 Answers  


Explain the difference between scrollbar and scrollpane?

1 Answers  


Which collection is ordered in java?

0 Answers  


What is entry in java?

0 Answers  


What are the major drawbacks of external iteration?

0 Answers  


what is the use of reference variable

6 Answers  


What is byte code and why is it important to java’s use for internet programming?

0 Answers  


Categories