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

Popular posts from this blog

How to set Java Object into JaxBElement ?

GitLab