public class TryCatchTest {
public static void MyNumber(String x) throws TryCatchException1{
try{
String y = x.substring(0,200);
}catch(TryCatchException1 e){
System.out.println("BBBBB");
System.out.println(e.getMessage());
// e.printStackTrace();
}catch(java.lang.StringIndexOutOfBoundsException e){
System.out.println("AAAAAAA");
e.printStackTrace();
e.getMessage();
}
}
}
class TryCatchException1 extends java.lang.StringIndexOutOfBoundsException{
TryCatchException1(){
super();
}
TryCatchException1(String msg){
super(msg);
}
}
why is my exception not caught on the first block of type TryCatchException1 ??? can't figure it out help..help.. my driver class just calls
TryCatchTest.MyNumber("myString");
thanks.