Given below the sample code :
public class SuperClass {
static String str = "";
public static void main(String[] args) {
try {
str += "2";
throw new Exception();
} catch (Exception e) { str += "3";
} finally { str += "4"; interrupt(); str += "6";
}
System.out.println(str);
}
static void interrupt() { int a = 0; int b = 8/a; }
}
What is the output of the above code:
1. 2 3 4
2. 2 3 4
3. 2 3 4 6
4. Error in compilation.
(4)
Compile error is due to the ' / by zero ' operation of method "interrupt()".
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.