Question: What will the following code display? String input = 99#7; int number; try { number = Integer.parseInt(input); } catch(NumberFormatException ex) {

What will the following code display?

String input = "99#7";

int number;

try

{

     number = Integer.parseInt(input);

}

catch(NumberFormatException ex)

{

     number = 0;

}

catch(RuntimeException ex)

     number = 1;

}

catch(Exception ex)

{

     number = -1;

}

System.out.println(number);

 a.

0

 

 b.

-1

 

 c.

99

 

 d.

1

 

Step by Step Solution

3.37 Rating (150 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

public class Test public static void mainString ar... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!