All of you are familiar with Exception meaning. Exception is an event that makes anything to terminate abnormally. In java, exception is said to occur when a program terminates abnormally. Of course, no one wants to end their application to stop unexpectedly so handling of these exceptions is necessary. There are three types of exceptions in java:These exceptions and errors are elements of throwable class.
Unchecked exceptions- Unchecked exceptions are those exceptions that are not recognized by compiler at compile time but checked by JVM at runtime, for example, arithmetic exception, array out of bound exception, string out of bound exception etc.
Checked Exceptions- the exceptions that are checked by the compiler for smooth execution of the program at run time are checked exception. This is not necessary in case of checked exception that the exception will occur but there will be a chance of occurrence of errors. These kinds of exceptions are thrown compulsorily. Ex. IO exception, file not found exception etc ate checked exceptions.
Error – Errors are those problems which occur due to some problem with the resources availabilities for which system is responsible like virtual memory exception. Since these errors occur due to lack of system fault so they are non-recoverable.
For every thread in java, JVM creates runtime stack. The method in which exception occurs is responsible to handle the exception. If there is no exception handler defined then JVM terminates process abnormally by calling java’s default exception handler and removes process from the stack.
. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . .
. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . . . .. . . . . . . .