Exception handling allows you to manage runtime errors using:
try, catch, finally, throw, throwstry {
int a = 5 / 0;
} catch (ArithmeticException e) {
System.out.println("Cannot divide by zero");
}
IOException)NullPointerException)Java automatically deallocates memory for unused objects using garbage collection. It improves memory efficiency and reduces memory leaks.