Header Ads Widget

WAP for Handling of user define exception.

  Code:-

class UserDefineException extends Exception
{
    public UserDefineException(String str)
    {
        super(str);
    }
}

class test
{
    public static void main(String args[])
    {
        try
        {   
            throw new UserDefineException("This is an User Define Exception");
        }
        catch(UserDefineException UDE)
        {
            System.out.println("Exception Catched");
            System.out.println(UDE.getMessage());
        }
    }
}

Output:-

Exception Catched
This is an User Define Exception




Recommended Post:

Full C course:-    

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-

Post a Comment

0 Comments