Question: Write the unchecked exception class InvalidAccountNumberException. The set method for the account number instance variable must test the validity of the account number that it
Write the unchecked exception class InvalidAccountNumberException.
The set method for the account number instance variable must test the validity of the account number that it receives against the criteria given above. If the account number is invalid the set method must throw an InvalidAccountNumberException.
Write the program TestExceptions.java that creates two objects each with valid and invalid account numbers. Each object must be created in a separate trycatch block and in each of the cases the exception that is thrown must be caught and handled by displaying an error message.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
