The rules: Formulate your answer before you run the code.
The code:
public class TestClass {
/**
*
*/
public TestClass() {
super();
}
public boolean foo() throws ArithmeticException {
try {
int Nan = 1 / 0;
} catch (ArithmeticException e) {
throw e;
} finally {
return true;
}
}
public static void main(
String[] args) {
TestClass
test = new TestClass();
boolean result = false;
try {
result = test.foo();
} catch (ArithmeticException e) {
e.printStackTrace();
}
System.out.println(result);
}
}
The question:
What gets printed to the console?
a) stack trace, then false
b) stack trace, then true
c) false
d) true
Why?