Thursday, February 21, 2013

Try Catch Exception

if more than one Exceptions were throw in the try block, then the first one threw will be catch.


addPatient() in PatientDAO

public static void main(String...s){
Bar bar = new Bar();
try{
bar.bar1();
throw new FooException("new Apple");
}catch(FooException e){
System.out.print(e.getMessage());
}catch(BarException e){
System.out.print(e.getMessage());
}
}
}

No comments:

Post a Comment