What classes of exceptions may be caught by a catch clause?

Long Answer
Views 25

Answer:

A catch clause can catch any exception that is a subclass of the Throwable class.
This includes both:

  • Error (serious system errors), and

  • Exception (runtime or checked exceptions).

For example:


catch (Throwable t) {
    System.out.println("Caught any type of throwable error or exception");
}

Related Articles:

This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Java Programming Language, click the links and dive deeper into this subject.

Join Our telegram group to ask Questions

Click below button to join our groups.