Source Code:
public class TryCatchExample {
public static void main(String[] args) {
try {
int a = 10 / 0;
} catch (ArithmeticException e) {
System.out.println(“Exception caught successfully”);
}
}
}
Output:
