Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Practice InterviewNew Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

Core Java Interview Questions and Answers

Ques. What is Unchecked Exception in java?
Ans.
Unchecked Exception in Java is those Exceptions whose handling is not verified during Compile time. Unchecked Exceptions mostly arise due to programming errors like accessing method of a null object, accessing element outside an array bonding or invoking method with illegal arguments. In Java, Unchecked Exception is direct sub Class of RuntimeException. What is major benefit of Unchecked Exception is that it doesn't reduce code readability and keeps the client code clean.

Use of UnCheckedException in Java
A good strategy of Exception handling in Java is wrapping a checked Exception into UnCheckedException. Since most of Database operation throws SQLException but itís not good to let SQLException propagate from your DAO layer to up higher on business layer and client code provide exception handling you can handle SQLException in DAO layer and you can wrap the cause in a RuntimeException to propagate through client code. Also as I said earlier unchecked exceptions are mostly programming errors and to catch them is real hard until you do a load test with all possible input and scenario.

Example of unchecked Exception in Java API
Here are few examples of Unchecked Exception in Java library:
NullPointerException
ArrayIndexOutOfBound
IllegalArgumentException
IllegalStateException
Is it helpful? Yes No

Most helpful rated by users:

©2020 WithoutBook