What is the difference between checked and unchecked exceptions?
Why Interviewers Ask This
This question tests conceptual clarity. Interviewers want to hear a precise, confident definition before moving to more complex Java topics. It also reveals how well you can explain technical ideas to non-experts.
Answer
Checked exceptions are exceptions that the compiler forces you to handle — either catch them with try-catch or declare them in the method signature using throws. They extend Exception (but not RuntimeException) and represent recoverable conditions like file not found (IOException) or SQL errors (SQLException). Unchecked exceptions (runtime exceptions) extend RuntimeException and do not need to be explicitly handled or declared — they represent programming errors like null pointer access (NullPointerException), array index out of bounds (ArrayIndexOutOfBoundsException), or illegal arguments (IllegalArgumentException). Error classes (like OutOfMemoryError) are also unchecked but represent unrecoverable JVM conditions.
Common Mistake
Many candidates answer correctly but can't explain the 'why'. Always be prepared to justify your answer with a concrete example or use case from your Java experience.
Previous
What is a try-catch block in Java?
Next
What is the difference between throw and throws in Java?