class UnderAge extends Exception{
 	private int age;
 	UnderAge(int x){
  		age=x;
 	}
 
 	public String toString(){
  		return "Your age " + age + " is Below 18"; 
 	}
}

class UnderAgeExceptionTest
{
  	static void test(int x) throws UnderAge{
   		if(x<18)
     			throw new UnderAge(x);
   		else
    			System.out.println("Valid Age: " + x);
  	}
  
  	public static void main(String []args){
    		try{
     			test(21);  // Use dynamic input here in your programs
      			test(17);
    		}catch(UnderAge e){
      			System.out.println("Exception Caught: " + e);
    		}
   	}
}
