fork download
  1. class ThrowsExecp {
  2. static void fun() throws Exception
  3. {
  4. throw new Exception();
  5. }
  6. public static void main(String args[])
  7. {
  8. try {
  9. fun();
  10. }
  11. catch (Exception e) {
  12. System.out.print("caught in main.");
  13. }
  14. System.out.print("All is well");
  15. }
  16. }
Success #stdin #stdout 0.09s 32120KB
stdin
Standard input is empty
stdout
caught in main.All is well