Java exception hierarchy
Exception:- exceptions indicates conditions that
reasonable application might “try” to “catch”
Q.4) what is hierarchy?
·
An exceptional errors type are subclasses of class throwable which are base classes of hierarchy. One branch is
headed by exception. This class is used for exception conditions the user program
should catch null PointerException.
·
Another branch error used by the java runtime system(JVM)
to indicate an error having to do with the runtime environment itself (JRE) stack
overflow error is an example of such an error.
Q.1) what are the parent classes in all classes of java?
·
Object is
the parent class of all the classes in the java
Q.2) which is the parent class in the all exception class?
·
throwable is
the parent class of all exception class
object |
Parent class of the all java class |
Throwable
|
Parent class of all exception class |
exception |
Child class of throwable |
error |
Child class of the exception |
Q.3) what is the different exception and error?
exception |
error |
|
In most cases, exceptions are occurred by our program |
An error occurred because of a lack of system resources not by our
program and thus, the program cannot do anything |
|
Exception recoverable by the programmer. Can handle then using
try and catch block |
Error not recoverable by the programmer can handle them to
their level |
|
An exception are two type |
Error is only one type Run time exception(unchecked exception) |
|
Compile-time (checked exception) |
Run time(unchecked exception) |
|
0 Comments