Checked and unchecked exceptions
In Java, exceptions are broadly divided into three main categories, based on how the compiler and runtime handle them: 1. Checked Exceptions Definition: Exceptions that are checked at compile-time. If your code might throw a checked exception, you must either handle it with a try-catch block or declare it with throws. These are typically…