Can you please tell me why the value of j is 7?
Thanks, Yuki
class Q29 {
public static void main(
String[] args) {
int j = 0;
Q29
test = new Q29();
try {
for (j=1 ; j < 5 ; j++)
{
j+= j;
}
int i = test.process() / (j = 5);
}
catch (Exception e) {
System.out.println(e);
System.out.println("Value of j = " + j);
}
}
int process() throws Exception {
throw new Exception("Exception Encountered");
}
}
Answer: Prints java.lang.Exception: Exception Encountered and Value of j=7.