• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

SoftwareTestingo - Jira Selenium Protractor Testing SDLC Agile Methodology

Java Selenium Tutorial & Testing Interview Questions

  • Home
  • Interview Questions
  • Java
  • Java Programs
  • Test Cases
  • Selenium
  • Manual Testing
  • Difference
  • Search
SoftwareTestingo » Java » Exception » Error Exception Hierarchy In Details in Java Updated

Error Exception Hierarchy In Details in Java Updated

Last Updated on: March 15, 2019 By Softwaretestingo Editorial Board

What We Are Learn On This Post

  • Error Hierarchy In Java
  • java.lang.Throwable
  • java.lang.Exception
  • java.lang.Error

Error Hierarchy Exception In Details in Java Updated

In this article, we will discuss the exception hierarchy in detail with figure and explanation

Error Hierarchy In Java

The Throwable class is the root class for every exception and it branches out to 2 main categories i.e.;

  1. Exception
  2. Error
Read Also: Rerun Failed test cases TestNG

java.lang.Throwable

  • Throwable is the root class for exception & it’s sub-type and error & it’s sub-types
  • In other words, it is a superclass for exception & error
  • java.lang.The throwable class extends java.lang.Object class (as shown in the above figure)
  • It defines 2 subclasses i.e.; Exception and Error

java.lang.Exception

  • java.lang.Exception is a superclass for all types of Exception
  • It extends java.lang.Throwable class
  • The exception is due to programmatic logic
  • And it is recoverable
  • An exception are categorized into a checked and unchecked exception
  • Example: RuntimeException, SQLException, IOException, FileNotFoundException, ArithmeticException, NullPointerException
Check: ClassCast Exception

java.lang.Error

  • java.lang.Error is a superclass for all types of Error
  • It extends java.lang.Throwable class
  • Error is due to lack of system resources
  • And it is non-recoverable
  • All error falls into unchecked exception category, as it is raised due to lack of system resources at runtime
  • It is out of programming scope as such type of error can’t predict, maybe well-planned care can be taken to avoid this kind of Error
  • Example: VirtualMachineError, AssertionError, ExceptionInInitializerError, StackOverflowError, OutOfMemoryError, LinkageError, InstantiationError

Note: the above-mentioned Exception and Error are again categorized into checked and unchecked exceptions

    Filed Under: Exception

    Reader Interactions

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

    Primary Sidebar

    Join SoftwareTestingo Telegram Group

    Tutorials Important Links

    • Software Testing Jobs
    • Manual Testing Tutorial
    • Selenium Tutorial
    • Core Java Tutorial
    • TestNG Tutorial
    • Java Programs
    • Selenium Programs
    • Manual Test Cases
    • Interview Tips
    • Contact US
    • www.softwaretestingo.com

    Important Links

    • Software Testing Interview Questions
    • Agile Interview Questions
    • Manual Testing Interview Questions
    • Testing Interview Questions
    • Selenium Interview Questions
    • Selenium Real Time Interview Questions
    • Selenium WebDriver Interview Questions
    • Automation Framework Interview Questions
    • Appium Interview Questions
    • TestNG Interview Questions
    • Java Interview Questions
    • Core Java Interview Questions

    Categories

    Copyright © 2021 SoftwareTestingo.com ~ Contact Us ~ Sitemap ~ Privacy Policy