Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6216423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:14:51+00:00 2026-05-24T07:14:51+00:00

I find Java’s exception hierarchy confusing. Throwable is divided into Error and Exception ,

  • 0

I find Java’s exception hierarchy confusing. Throwable is divided into Error and Exception, and RuntimeException inherits from Exception.

  1. Error is an unchecked exception. Why doesn’t Error inherit from RuntimeException then?

  2. Exception is a checked exception. RuntimeException is an unchecked exception, yet it inherits from Exception. Doesn’t this violate the Liskov-Substitution-Principle?

Wouldn’t it make more sense if Throwable were divided into Exception (checked) and RuntimeException (unchecked), and Error would inherit from RuntimeExeption?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T07:14:51+00:00Added an answer on May 24, 2026 at 7:14 am

    I find Java’s exception hierarchy confusing. Throwable is divided into Error and Exception, and RuntimeException inherits from Exception.

    A Throwable is anything that can be used to unwind the call stack. This should include some VM level fault (flagged by an Error) and something application specific (flagged by an Exception)

    Error is an unchecked exception. Why doesn’t Error inherit from RuntimeException then?

    Simply because Errors are not Exceptions. There wouldn’t be any point in actually “catching” an Error. For eg. What would you do after catching an OutOfMemoryError. Errors are meant to flag something seriously happened at the VM level which is not necessarily handle-able by the programmer

    Exception is a checked exception. RuntimeException is an unchecked exception, yet it inherits from Exception. Doesn’t this violate the Liskov-Substitution-Principle?

    Not really. What the implementors were trying to say was that Exceptions MUST always be checked. Your code will be cleaner if all your methods declare what sort of application/library Exceptions they throw. RuntimeExceptions should only be thrown in case of more general / dynamic situations such as a NullPointerException where the developer might not have coded for the case but is a serious bug which is not exactly something mentioned in the application spec.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm coming from c#, and find java's switch statement a bit confusing. You can
I need a Java way to find a running Win process from which I
Looking a solution for strange JTDS error message: Could not find a Java charset
I'm trying to find a Java library to highlight code. I don't want to
I am trying to find my java class URL in order to use it
Well, I must be brain-damaged, because I can't find the java source for Sun's
I googled,I checked wikipedia.None of them helped me to find an official java compiler
I find it funny that Java (or the java.util library) does not have a
I find myself with a need for a java utility for taking a fully-qualified
How do you find a memory leak in Java (using, for example, JHat)? I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.