What is user-defined exception in java ?
Ans: User-defined expectations are the exceptions defined by the application developer which are errors related to specific application. Application Developer can define the user defined exception by inherited the Exception class as shown below. Using this class we can throw new exceptions for this we have use throw keyword . Example of user define exception Java Example : 1.Create an class which extends Exception:- public class greaterVlaueException extends Exception { } 2.Throw an exception using a throw statement: public class Fund { /java/. public Object getFunds() throws greaterVlaueException { if (id>2000) throw new greaterVlaueException(); /java/. } } User-defined exceptions should usually be checked.