What is the difference between Checked and Unchecked
exception? Give some examples

Answer Posted / padmaja

1. Checked exceptions are exceptions that must be
declared in the throws clause of a method. A checked
exception indicates an expected problem that can occur
during normal system operation. Checked exceptions must be
2. Unchecked exceptions are exceptions that do not
need to be declared in a throws clause. An unchecked
exception indicates an unexpected problem that is probably
due to a bug in the code. The most common example is a
NullPointerException.They don't have to be caught or
declared thrown.
3. Checked exceptions in Java extend the
java.lang.Exception class. Unchecked exceptions extend the
java.lang.RuntimeException.

Is This Answer Correct ?    2 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is java so popular?

854


What is ellipsis in java?

818


List implementations of list interface?

798


What is communist flag?

771


What is difference between protected and private?

762


What is a copy constructor in java?

822


Why object class is super class for every class in java?

806


What are the two basic ways in which classes that can be run as threads may be defined?

822


Can substring create new object?

787


What is :: operator in java?

710


What is skeleton and stub?

767


What are the major drawbacks of external iteration?

819


You're given a Boolean 2D matrix, can you find the number of islands?

854


How many digits can a float hold?

755


What is double in java?

738