What are exceptions in Java?

Exceptions in Java are runtime events that interrupt the normal flow of program execution. They represent abnormal conditions or errors that occur during execution and can be handled to prevent the application from terminating unexpectedly.

Key Points

Example

If a program attempts to divide a number by zero or access a file that does not exist, Java throws an exception to indicate the error condition.

public class ExceptionDemo {

    public static void main(String[] args) {

        try {
            int result = 10 / 0;
        } catch (ArithmeticException e) {
            System.out.println("Cannot divide by zero");
        }
    }
}

Interview Tip

A concise interview answer is

Exceptions are events that occur during program execution and disrupt the normal flow of the application. In Java, exceptions are represented as objects and can be handled using try-catch blocks to ensure graceful error handling.

Last updated: 11 November 2026

Previous question: What is a package in Java?

Next question: What is a thread in Java?

More Core Java - Level I interview questions

All Core Java - Level I questions