Is this statement/example valid for checked and unchecked exception?
Unchecked Exception: The exceptions that are not checked at compile time are called unchecked exceptions. Example:
public class UncheckedException {
public static void main(String[] args) {
int value = 10/0;
}
}
Checked Exception: The exceptions that are checked at compile time are called Checked exceptions. Example:
public class CheckedException {
public static void main(String[] args) {
try {
int value = 10/0;
} catch (Exception e) {
System.out.println("Caught " + e);
}
}
}