class InvalidageExeption extends Exception
{
InvalidageExeption(String s)
{
super(s);
}
}
class TestException
{
static void validate(int age) throws InvalidageExeption
{
if(age<18)
throw new InvalidageExeption("not valid");
}
public static void main(String[] args) throws InvalidageExeption
{
validate(13);
}
}
No comments:
Post a Comment