Solved

Analyze the Following Program. Class Test

Question 22

Multiple Choice

Analyze the following program. class Test {
Public static void main(String[] args) {
Try {
String s = "5.6";
Integer.parseInt(s) ; // Cause a NumberFormatException
Int i = 0;
Int y = 2 / i;
System.out.println("Welcome to Java") ;
}
Catch (Exception ex) {
System.out.println(ex) ;
}
}
}


A) An exception is raised due to Integer.parseInt(s) ;
B) An exception is raised due to 2 / i;
C) The program has a compilation error.
D) The program compiles and runs without exceptions.

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions