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
Step: 1
public class Test public static void mainString ar...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 StartedRecommended Textbook for
Introduction To Business Statistics
Authors: Ronald M. Weiers
7th Edition
978-0538452175, 538452196, 053845217X, 2900538452198, 978-1111524081
Students also viewed these Programming questions
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
View Answer in SolutionInn App