package testing.automationTesting; public class customException extends Exception{ customException(){ } customException(String s){ super(s); } static void validate(int age) throws customException{ if(age<18) throw new customException("Invalid.Age.Format.Exception - Age should be 18"); else if(age>18) throw new customException("Invalid.Age.Format.Exception - Age should be 18"); else System.out.print(""); } public static void main(String[] args) { try{ validate(19); } catch(Exception m){ System.out.println("Exception is: "+m); } } }
This Blog gives good knowledge of core java concepts and selenium (Automation Testing Tool). It also includes some topics of MAVEN (Build Tool) , Jenkins (Continuous Integration Tool) and Cucumber (Behavior Driven Development)
Monday, 29 June 2015
Java Custom Exception (Core JAVA)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment