Question: Question 2 9 Analyze the following program. class Test { public static void main ( String ] args ) { try { String s =

Question 29
Analyze the following program.
class Test {
public static void main(String] args){
try {
String s=?n5.6";
Integer.parselnt(s); // Causes a NumberFormatException
int i=0;
int y=2i;,?? Causes an ArithmeticException
System.out.printIn("Welcome to Java");
}
catch (Exception ex){
System.out.println(ex);
}
}
}
An exception is raised due to Integer.parseInt(s);
An exception is raised due to 2i;
The program has a compilation error.
The program compiles and displays "Welcome to Java".
The program compiles and displays "For input string: 5.6" then "Divide by zero" then "Welcome to Java"
Question 2 9 Analyze the following program. class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!