Question: Look at the following program and tell what it will output when run: Public class ExceptionTest { Public static void main(String[] args) { Int number;

Look at the following program and tell what it will output when run: 

Public class ExceptionTest
{
 Public static void main(String[] args)
 {
 Int number;
 String str;
 Try
 {
 Str = "xyz";
 Number = Integer.parseInt(str);
 System.out.println("A");
 }
 Catch(NumberFormatException e)
 {
 System.out.println("B");
 }
 Catch(IllegalArgumentException e)
 {
 System.out.println("C");
 }
 System.out.println("D");
 }
}

Step by Step Solution

3.35 Rating (161 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

A xyz B A is not a valid integer value C B is not a valid intege... 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 Starting Out With Java From Control Structures Questions!