Java - Custom Exception
Custom Exception:
·
If you defined your own exception that is called
custom exception.
class InvalidPIN extends Exception{
InvalidPIN (String s){
super(s);
}
}
If(pin != 1234){
throw new InvalidPIN ("Invalid PIN");
}
Comments
Post a Comment