In my web application created a User defined exception extends with Exception.Is it Checked or unchecked exception
public class InvalidDataException extends Exc
It's a checked exception class. Any class which extends Exception class will be a user defined Checked exception class. Where as any class which extends RuntimeException will be Unchecked exception class.
User Defined exceptions are checked exceptions because they are extended with Exception class which is super class for all the exceptions occured,where as unchecked exceptions are extended with run time Exceptions.
You could have used IllegalArgumentException.
This exception is unchecked whereas yours is checked as @duffymo & @aix commented.
THere are two classes call as partially checked exception.
1.) Exception class
2.) throwable class
It calls partially checked because some of their subclasses are Unchecked. So you have extended the Exception class then it's Checked exception
Only those exceptions that are subclasses of RuntimeException are considered unchecked.
Yours isn't, and therefore is a checked exception.