AnswerBox
Java

Exception Handling

Description:
Handle division by zero with try-catch.
Java Code
public class ExceptionDemo {
    public static void main(String[] args) {
        try {
            int result = 10 / 0;
        } catch (ArithmeticException e) {
            System.out.println("Error: " + e.getMessage());
        } finally {
            System.out.println("Done.");
        }
    }
}
Expected Output
Error: / by zero Done.