What are the three types of exceptions?

Asked by: Prof. Jessica Wisoky  |  Last update: June 25, 2026
Score: 4.4/5 (11 votes)

In programming, particularly Java, the three main types of exceptions are checked exceptions, unchecked (runtime) exceptions, and errors. These categories differentiate whether the compiler forces handling and whether the issue is recoverable or fatal.

What are different types of exceptions?

Exceptions are errors or unexpected events that occur during program execution, generally classified into checked exceptions (checked at compile-time) and unchecked exceptions (runtime errors). They allow programs to handle errors gracefully rather than crashing. Key types include NullPointerException, IOException, and ArgumentException, which indicate specific issues like memory access, file handling, or invalid inputs.

What are the three built-in exceptions?

Some commonly used built-in exceptions are: ArithmeticException — Occurs during invalid arithmetic operations like division by zero. ArrayIndexOutOfBoundsException — Occurs when an invalid array index is accessed. ClassNotFoundException — Occurs when a class is not found.

What are two types of exceptions?

Types of exceptions

  • Checked exceptions: These are the exceptions that are checked by the compiler at compile time. ...
  • Unchecked exceptions: These are the exceptions that are not checked by the compiler at compile time.

What are the 4 types of error?

The four main types of error in scientific measurement and experimentation are systematic errors (consistent bias), random errors (unpredictable fluctuations), gross errors (human mistakes), and environmental errors (external factors). These errors affect the accuracy and precision of experimental data, often resulting from faulty equipment, improper techniques, or uncontrollable variables.

Checked vs. Unchecked Exceptions in Java Tutorial - What's The Difference?

17 related questions found

What do some exceptions mean?

/ɛkˈsɛpʃɛn/ Other forms: exceptions. An exception is something that is left out or not done on purpose. An exception to a rule does not follow that rule. This word is used for all sorts of things that are not usual or usually allowed.

What is the main class of exception?

The Throwable class is the superclass of all Java exceptions and errors. It has two subclasses, Error and Exception but they don't represent checked and unchecked exceptions. The Exception class has a subclass called RuntimeException that contains most unchecked exceptions.

How many ways can we handle exceptions?

We can handle multiple type of exceptions in Java by using multiple catch blocks, each catching a different type of exception.

What are best practices for exceptions?

And without further ado, here are the list of best practices we promised you.

  • Clean Up Resources in a Finally Block or Use a Try-With-Resource Statement. ...
  • Prefer Specific Exceptions. ...
  • Document the Exceptions You Specify. ...
  • Throw Exceptions With Descriptive Messages. ...
  • Catch the Most Specific Exception First. ...
  • Don't Catch Throwable.

Why are exceptions important?

The primary purpose of exceptions is to provide a structured mechanism for handling errors and unexpected events in software without crashing the application. They separate error-handling code from the main business logic, allowing for cleaner code, better control flow, and the ability to propagate error handling up the call stack.

What is called an exception?

Definition: An exception is an event that occurs during the execution of a program that disrupts the normal flow of instructions.

Which of the following is an example of an exception?

Examples of exceptions include NullPointerException, IndexOutOfBoundsException, FileNotFoundException, and many others. Unlike syntax errors which are caught during the compilation phase, runtime errors like exceptions are detected during the program's execution.

What are the types of checked exceptions?

Some common examples of checked exceptions in Java include: IOException : Thrown when an input or output operation fails, such as file I/O errors. SQLException : Thrown when there is an issue with database connectivity or queries. FileNotFoundException : Thrown when attempting to access a file that does not exist.

What are type 3 errors?

A Type III error occurs when a researcher or decision-maker provides the right answer to the wrong question. While Type I (false positive) and Type II (false negative) errors focus on statistical errors in hypothesis testing, Type III errors represent a conceptual, structural, or framing error where the wrong problem is solved precisely.

What is a type 4 error?

A Type IV error (or Type 4 error) generally refers to the incorrect interpretation of a correctly rejected null hypothesis, or in broader contexts, a deliberate mistake in judgment, such as solving the wrong problem through willful ignorance or malice. While Type I and II errors are standard, Type IV is a conceptual error used to describe flawed analysis or strategic decision-making.

What are 5 types of errors in programming?

The five most common types of errors in programming are syntax, runtime, logical, semantic, and linker errors. Understanding these helps programmers identify whether a problem is a grammatical mistake in the code or a deeper flaw in the program's logic.