Given:
public class Main { static String s = "-"; public static void main(String[] args) { try {/*www. ja v a2s . c o m*/ throw new Exception(); } catch (Exception e) { try { try { throw new Exception(); } catch (Exception ex) { s += "ic "; } throw new Exception(); } catch (Exception x) { s += "mc "; } finally { s += "mf "; } } finally { s += "of "; } System.out.println(s); } }
What is the result?
E is correct.
There is no problem nesting try/catch blocks.
When an exception is thrown, the code in the catch block runs, and then the code in the finally block runs.