fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void one() throws Exception {
  11. try {
  12. System.out.println("One");
  13. throw new Exception();
  14. } catch (Exception e) {
  15. System.out.println("Catch one");
  16. throw new Exception();
  17. } finally {
  18. System.out.println("Finally one");
  19. }
  20. }
  21. public static void two() throws Exception {
  22. try {
  23. System.out.println("Two");
  24. throw new Exception();
  25. } catch (Exception e) {
  26. System.out.println("Catch two");
  27. if (2 != 3) throw new Exception();
  28. }
  29. System.out.println("After two");
  30. }
  31.  
  32. public static void main (String[] args)
  33. {
  34. try { one(); } catch (Exception e) {}
  35. try { two(); } catch (Exception e) {}
  36. }
  37. }
Success #stdin #stdout 0.05s 4386816KB
stdin
Standard input is empty
stdout
One
Catch one
Finally one
Two
Catch two