1 Answers
Checked vs. Unchecked Exceptions in Java
In Java, exceptions can be classified as either checked or unchecked.
Checked Exceptions:
Checked exceptions are the exceptions that are checked at compile time. This means that the compiler forces the programmer to handle these exceptions using try-catch blocks or by declaring them in the method signature using the 'throws' keyword.
Example of checked exception in Java: IOException
Unchecked Exceptions:
Unchecked exceptions, also known as runtime exceptions, are the exceptions that are not checked at compile time. Programmers are not forced to handle unchecked exceptions explicitly.
Example of unchecked exception in Java: NullPointerException
Please login or Register to submit your answer