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
A xyz B A is not a valid integer value C B is not a valid intege... View full answer
Get step-by-step solutions from verified subject matter experts
