Styrow.dev
Question 204 of 247
Java Topic: General medium

What are the types of Exceptions in Java

Question

What are the types of Exceptions in Java

Answer

There are two types of exceptions in Java, unchecked exceptions and checked exceptions. • Checked exceptions: A checked exception is some subclass of Exception (or Exception itself), excluding class RuntimeException and its subclasses. Each method must either handle all checked exceptions by supplying a catch clause or list each unhandled checked exception as a thrown exception.

• Unchecked exceptions:All Exceptions that extend the RuntimeException class are unchecked exceptions. Class Error and its subclasses also are unchecked.