user defined exception user defined exception in java example user defined exception in java user defined exception handling in java user defined exception java java user defined exception example custom defined exception what is user defined exception handling in java custom defined exception in java custom defined exception in java with example guidelines for developing exception handling in java what are the guidelines for developing exception handling in java steps for developing exception handling in java what are the steps for developing exception handling in java steps for developing exception in java
User Defined Exception / Custom-defined Exceptions:
User Defined Exceptions are those which are developed by java programmer and
supplied as apart of their project to deal with common specific problems.
In order to develop user defined Exception Handling based applications, as a programmer, we come across three stages they are.
1) User defined Exception sub classes
2) User defined General / Common classes
3) User defined Specific Classes
1) User defined Exception sub classes:
Guide Lines / Steps For Developing User Defined Exceptions:
1) Choose an appropriate package for placing user defined Exceptions sub classes for
common access and ensure package statement must be First executable statement.
2) Choose an appropriate user defined class and ensure whose modifier must be public
and this class is going to called user defined exception subclass.
3) Whatever class is selected in step 2 it must extends either Java.lang.RuntimeException
or java.lang.Exception for gaining the power for stop the program execution abnormally
whenever the application user enter’s invalid input’s.
Hence step2 is known as User –defined Exception sub class.
4) Each and every User defined Exception subclass must contain parameterized constructor
by taking string as parameter.Here String parameter represents nature of the message.
5) Each and every user-defined Exception parameterized constructor either
java.lang.RuntimeException or java.lang.Exception by using super(String message).
2) Development of User defined General Class:
User defined general class makes use of user defined Exception sub class 3)
3) Development of User defined Specified Class:
This development is used by individual programmer and this class makes use of
user defined general classes and user defined Exception sub classes
- Example For User Defined Exceptions
- What is Exception handling and types of exception handlings
- What is Exception and list of Exceptions and exception hierarchy