UNB/ CS/ David Bremner/ teaching/ java/ ExceptionTest2.java
public class ExceptionTest2 {
  
  public static void methodA(int a, int b){
    if (a<1){
      throw new RuntimeException(Integer.toString(b));
    } else {
      methodA(a-1,b*a);
    }

  }
    

  public static String methodB(int a, int b){
    try {
      methodA(a,b);
    }
    catch (RuntimeException rte){
      return rte.toString();
    } 
    return "oops";
  }

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