Exception Handling in Java | Practice Questions

Employee Registration Program

Write a program for Employee registration process, take the employee details like empId, empName, age from user and register employee through addEmployee method, and throw the user defined exception like AgeMisMatchException, if the age of the employee is not greater than 18.

Division Program

Write a program for division of two numbers , class will take two numbers from key board and if numbers are not dividable then class throws ArithmaticException. Wrap the code in try catch block.

Company Recruiting Program 

Write a program for the below scenario. Company is recruiting the persons for one job opening, company has decided to take persons for the job only if the age is in between 22 and 35. if the person age is below 22 class should throw TooYoungException and if the person age is above 35 class should throw TooOldException. TooYoungException and TooOldExceptions are child classes of Age Exception.

Get Project Solution Now

Comments