import java.io.IOException;
class subEx extends IOException {}
class A{
public static void main(
String[]args)throws Exception{
try{
method();
}catch(IOException e){
System.out.println("Main()--1 exception");
}catch(Exception e){
System.out.println("Main()--2 exception");
}
}
static void method() throws IOException{
try{
throw new subEx();
}catch(IOException e){
System.out.println("method()---1 exception");
throw new subEx();//why can't be
//caught in the mehod() and must go to the main ?
}catch(Exception e){
System.out.println("method()---2 exception");
}
}
}
//Why the example's result is:
//method()---1 exception and Main()---1 exception
//I really want to know in the method() ,
//why the second " new subEx()"can't be caught
//in the method()?
[ March 04, 2002: Message edited by: Tu Ran ]