0 votes
in JAVA by
How many types of exception can occur in a Java program?

1 Answer

0 votes
by

There are mainly two types of exceptions: checked and unchecked. Here, an error is considered as the unchecked exception. According to Oracle, there are three types of exceptions:

  • Checked Exception: Checked exceptions are the one which are checked at compile-time. For example, SQLException, ClassNotFoundException, etc.
  • Unchecked Exception: Unchecked exceptions are the one which are handled at runtime because they can not be checked at compile-time. For example, ArithmaticException, NullPointerException, ArrayIndexOutOfBoundsException, etc.
  • Error: Error cause the program to exit since they are not recoverable. For Example, OutOfMemoryError, AssertionError, etc.

Related questions

0 votes
asked May 5, 2021 in JAVA by SakshiSharma
+3 votes
asked May 12, 2021 in JAVA by rajeshsharma
...