Exception is the unwanted or the unexpected event ,Which occurs during the execution of a program and disturbs the normal flow of execution.
Errors are because of System failure.
Exception vs Error
Exception Error
1.Exception occur because of programs. 1. Error occur because of Lack of System resources not because of the programs hence programmer can not do anything.
2.Exceptions are recoverable . 2.Errors can not be recoverable.
3.We can recover exception by handling it. 3.We have to contact with system administrator.
4.Exceptions are of two types 4. Errors are of type Runtime only.
a.Checked Exception(Compiletime)
b.Unchecked Exception(runtime)
5.SQLException,IOException,etc 5.VirtualMemoryError, StackoverflowError
Checked Exception vs Unchecked Exception
Checked Exception
1.Checked Exception are also know as compile time Exception.
2.Compiler can check these Exceptions at the time of compilation
3.SQLException,IOException,FilenotfoundException,etc comes under this Exception.
UnCheckedException
1.UncheckedExceptions are also known as runtime Exception.
2.The Exceptions which compiler ignores are called unchecked exception.
3.NullpointerExceptios,ArithmaticException,etc comes under unchecked Exceptions.
0 Comments:
Post a Comment