Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Some of the questions below refer to the following Java code: package cs1302.exceptions; public class PhoneNumberParser( public static void main(String[ args) string phoneNumber args[0]; //
Some of the questions below refer to the following Java code: package cs1302.exceptions; public class PhoneNumberParser( public static void main(String[ args) string phoneNumber args[0]; // Expected format : ##.###-f### int areaCode0, prefix 0, lineNumber0 try areaCode = Integer.parseInt (phoneNumber.substring(0,3)); prefix = Integer.parseInt(phoneNumber. substring (4,7)); lineNumberInteger.parseInt (phoneNumber.substring (8,12)) catch (StringIndexoutofBoundsException exception) System.out.println ("Not long enough") } catch (NumberFormatException exception) { System.out.println ("Not a number" finally ( System.out.println("Area code: "areaCode) System.out.println( "Prefix: "+prefix) System.out.println ("Line Number:"lineNumber) ) 1/ try // main ) // PhoneNumberParser uestion 2 (1 point) What happens when the cs1302.exceptions.PhoneNumberParser program is run with no command-line arguments? Select all that apply. Outputs: Not long enough Question 2 (1 point) What happens when the cs1302.exceptions.PhoneNumberParser program is run with no command-line arguments? Select all that apply Outputs: Not long enough Outputs: Not a number Program crashes with an ArrayIndexOutOfBoundsException. Outputs: Area code: 123 Prefix: 456 Line Number 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started