Question: Create a user defined exception InvalidAgeException by extending the java Exception class. The method prototype is given as validate(int age) throws InvalidAgeException. If the age

Create a user defined exception InvalidAgeException by extending the java Exception class. The method prototype is given as validate(int age) throws InvalidAgeException. If the age of a person is less than 18 years throw an exception and prints Exception occurred: Candidate is less than 18 year is not allowed to vote. Otherwise print "rest of the code
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
