What is a checked exception in Java?
💡 Model Answer
In Java, a checked exception is an exception that must be either caught with a try‑catch block or declared in the method signature using the throws keyword. The compiler enforces this requirement, ensuring that callers are aware of potential error conditions. Checked exceptions represent recoverable conditions that a program should handle, such as IOException or SQLException. They differ from unchecked exceptions (RuntimeException and its subclasses), which are not required to be declared or caught. Using checked exceptions encourages explicit error handling and improves code robustness.
This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.
🎤 Get questions like this answered in real-time
Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers on a discreet on-screen overlay.
Get Assisting AI — Starts at ₹500