Answered step by step
Verified Expert Solution
Link Copied!

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]; //

image text in transcribedimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions

Question

How did the exposure treatment eventually help Andrea?

Answered: 1 week ago