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()".