Question: Create a Test class that will ask the user to enter a mobile number of 8 - digits. If the phone number is not 8
Create a Test class that will ask the user to enter a mobile number of digits. If the phone number is not digits, it should throw an illegal argument exception that the entered mobile number is not eight digits, then ask the user to enter the phone number again until the user enters a valid digits number. Your code should handle another type of exception that may occur. Dont write a general catch phrase with the super class Exception. Be specific with the exception type. Sample output Enter digit phone Number java.lang.IllegalArgumentException: Invalid phone number! Try again Enter digit phone Number Valid phone number
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
