fork download
  1. class Teste {
  2. public static void main(String[] args) {
  3. func1();
  4. }
  5.  
  6. public static void func1() {
  7. try {
  8. func2();
  9. } catch (Exception e) {
  10. System.out.println("Error 1");
  11. }
  12. }
  13.  
  14. public static void func2() {
  15. try {
  16. int x = 1 / 0;
  17. } catch (Exception e) {
  18. System.out.println("Error 2");
  19. throw e;
  20. }
  21. }
  22. }
  23.  
  24. //https://pt.stackoverflow.com/q/160541/101
Success #stdin #stdout 0.07s 32344KB
stdin
Standard input is empty
stdout
Error 2
Error 1