UNB/ CS/ David Bremner/ teaching/ java/ ExceptionTest4.java
public class ExceptionTest4 {
  
  public static void methodA(int a, int b){
    System.out.println("methodA: a=" +a+ " b="+b);
    if (a<=1){
      throw new RuntimeException();
    } else {
      methodA(a-1,b*a);
    }

  }
    

  public static String methodB(int a, int b){
    try {
      methodA(a,b);
    }
    catch (RuntimeException rte){
      return "Donald Duck";
    } 
    return "Goofy";
  }

  public static void main(String[] args){
    
    try {
      methodA(3,1);
      System.out.println("Pluto");
    } 
    catch(RuntimeException rte){
      System.out.println("Mickey Mouse");
    }
    System.out.println(methodB(4,1));
  }
}