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
Why string is not a wrapper class?
I want to store more than 10 objects in a remote server? Which methodology will follow?
Why do I need to declare the type of a variable in java?
How does system arraycopy work in java?
What are thread local variables?
Why are the destructors for base class and derived class called in reverse order when the program exits
What is java Applet?
What is the technique adopted to create an immutable class?
When will we use them?
What function extracts specified characters from a string?
How does thread synchronization occurs inside a monitor? What levels of synchronization can you apply?
What is the use of static class?
What is collection api?
What is the purpose of the file class in java programming?
Is linkedlist thread safe in java?