Exception Handling
Exception Handling
Exception handling in Java lets you manage errors and prevent program crashes.
Example of try-catch block:
try {
int result = 10 / 0;
} catch (ArithmeticException e) {
System.out.println(“Error: Division by zero!”);
}