0

If we want to make a checked exception, we can extend the Exception class, and for unchecked exceptions we can extend the RuntimeException class.

But the Exception class is a super for RuntimeException, so why can't I make a runtime exception class using the Exception class?

Extending Exception/RunTimeException in java?

Community
  • 1
  • 1

1 Answers1

0

That is just a feature of the language. Keep in mind that there are other Throwable classes, most notably Error and its children, none of which you are required to check for. Exception and RuntimeException are just markers in the inheritance tree that the compiler uses to check if a Throwable needs to be checked or not, pretty much because the authors of the language decided that those would be the names of those markers.

Mad Physicist
  • 107,652
  • 25
  • 181
  • 264