Skip to main content

Posts

Showing posts with the label user-defined exception

User Defined Exception Handling

Introduction: To develop the project, we must create our own Exception class, as Sun microsystem has not given any exception class some requirements which are not in common. So, what is User defined exception is? Exception class defined by Developer is called as User Defined Exception or Custom exception Steps to create User Defined Exception: Write a class that extends java.lang.Exception. In User defined class, define minimum 2 constructors. No-argument constructor String parameter with logic “super(message)” to create exception object with message.  No need to define any method, why because exception class is not meant for developing business logic , instead it is used for terminating method logic execution by throwing it’s object. ------------------------------------------------------------------------------------------------------------ package com.app.exceptions; /**  *  * @author Shashank Mungantiwar  * ...