package ExceptionHandling;

public class ExceptionClass extends Exception {
	
	ExceptionClass () {
	}

	//parametrised constructor
	ExceptionClass (String str) {
		super(str);
	}
	
	public static void main(String args[]) 
    {   
    		try
        {
    			ExceptionClass selfMadeException = new ExceptionClass("hoi");
    			throw selfMadeException; 
        } 
        catch (ExceptionClass element) 
        {   
            System.out.println(element);
        } 
    }
}

Why to use a try and catch function ?