Question: OOP JAVA Exercise 3: Complete the program below in order to make run properly by competing Phone Number methods and add try-catch block in the
OOP JAVA
Exercise 3: Complete the program below in order to make run properly by competing Phone Number methods and add try-catch block in the main method. (Hint: phone number is a String of all numbers and its length is 9 or 10] public class ExceptionWithThrow { public static String validPhoneNum (String name) throws InputMismatchException { // check here if the phone number is valid // throw InputMismatchException if invalid // return the name if it is valid } public static void main(String[] args) { // Ask the user to enter a phone number // check the phone validity through validPhoneNum method // Add try and catch block around appropriate statements }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
