Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the following code, and assuming readData() has been called from main(), what is the output if EX is read into codeStr? public void

image text in transcribed 

Given the following code, and assuming readData() has been called from main(), what is the output if "EX" is read into codeStr? public void main( String [] args) { Scanner kbd = new Scanner(System.in); try { } readData( kbd): } catch (Exception e) { System.out.println("An Exception occurred"); } } finally { } kbd.close(); public static void readData( Scanner in ) { String numStr, codeStr; try { System.out.println("Done."); } codeStr = in.next(): numStr = Character.toString( codeStr.charAt( 2 ) ); int num = Integer.parseInt(numStr); } catch (NumberFormatException nfe) { System.out.println( numStr + " is not a number."); a. is not a number. Done. O b. An Exception occurred Done. O c. An Exception occurred O d. Done.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

The detailed answer for the above question is provided below The provid... 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

Introduction To Programming With Java A Problem Solving Approach

Authors: John Dean

3rd International Edition

1260575241, 9781260575248

More Books

Students also viewed these Programming questions

Question

What does a flip() method call do?

Answered: 1 week ago