What exception is raised by the following code :
public class Example17 {
static String str = "";
public static void main(String[] args) {
try {
str += "an";
throw new Exception();
} catch (Exception e) { s += "k";
} finally { str += "i"; calculate(); str += "t";
}
System.out.println(s);
}
static void calculate() { int x = 0; int y = 7/x; }
}
What exception is raised by the following code :
1.no exception is raised by the code.
2. java.lang.ArithmeticException
3. class not found Exception.
4. null pointer exception
(2)
Because the "calculation()" method has a illegal Expression i.e. y=7/x , due to this method "ArithmeticException" is raised.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.