Define Exception :-
=>The disturbance which is occured from the application is known as Exception.
Define Error :-
=>The disturbance which is occured from the environment is known a Error.
Define Exception Handling process :-
=>The process which is used to handle the exception is known as Exception Handling process.
=>The following are the blocks used in constructing Exception Handling process:
=>try block will hold the set-of-statements which are going to raise the exception.
=>when the exception is raised in try block, one object is created for Exception_type_class and the reference of object is thrown onto catch block.
=>catch block will hold the reference of object thrown from the try block and the required msgs are generated from the catch block.
=>finally block is part of exception handling process,but executed independently without depending on exception.
=>In realtime finally blocks are used to hold resource closing operations. (IO Closing,File Closing,DB Closing… )
Define ‘Throwable’ class
=>’Throwable’ class is from ‘java.lang’ package and which is root of exception handling process.
=>This ‘Throwable’ class is extended into the following two SubClasses:
Hierarchy of ‘Throwable’ class:
=>’Error’ class is the SuperClass or PClass of all the disturbances occured from the
=>There is no separate process to handle the errors.
=>’Exception’ class is the SuperClass or PClass of all the disturbances occured from the application.
=>The Exceptions are categorized into two types:
=>The exceptions which are not identified by the compiler at compilation stage will
be raised at execution stage are known as UnChecked exceptions or Runtime exception.
=>These UnChecked exceptions are categorized into two types:
(i)Built-In Unchecked exceptions
(ii)User defined UnChecked exceptions
(i)Built-In Unchecked exceptions:
=>The UnChecked exceptions which are available from JavaLib are known as Built-In
UnChecked Exceptions or Pre-Defined UnChecked exceptions.
=>when these Built-in UnChecked exceptions are raised,then the executionControl
will create object for Exception_type_class and throw the reference onto catch
(ii)User defined UnChecked exceptions:
=>The process of defining and raising UnChecked exceptions are known as ‘User defined
=>In User defined UnChecked exceptions,we have to create object for the class from
where the exception is raised and throw the reference on to catch block using ‘throw’
=>The exceptions which are identified by the compiler at compilation stage are known as Checked Exceptions or Compile time exceptions.
=>These Checked Exceptions are categorized into two types:
(i)Built-In Checked Exceptions
(ii)User defined Checked Exceptions
(i)Built-In Checked Exceptions:
=>The Checked exceptions which are available from JavaLib are known as Built-In checked exception or PreDefined Checked exceptions.
=>The ‘throws’ keyword added with method signature specify to ignore the exception (disturbance) from the current method and raise at method_class.
=>when the exception is raised at method_call then it is identified by the compiler at compilation stage,because of this reason it comes under CompileTime exception or Checked Exception.
wt is the diff b/w
=>’throw’ keyword is used to throw the reference from the try block to catch block.
=>’throws’ keyword is used to ignore the exception from current method and raise
at method call.
(ii)User defined Checked Exceptions:
=>The Checked exceptions which are defined and raised by the programmer are known as User defined Checked Exception.
=>In the process of defining and raising “User defined checked exceptions”, we use ‘throw’ keyword part of catch block to perform re-throwing process and we also declare ‘throws’ keyword with method_signature to ignore the exception in current method and raise at method_call.