public class Test {
public static void main(String args[]) {
Test test = new Test();
try {
test.method1();
} catch (SomeException e) {
e.printStackTrace();
}
}
public void method1() throws SomeException{method2();}
public void method2() throws SomeException{method3();}
public void method3() throws SomeException{
throw new SomeException("SomeException occur in method3");
}
}
public static void main(String args[]) {
Test test = new Test();
try {
test.method1();
} catch (SomeException e) {
e.printStackTrace();
}
}
public void method1() throws SomeException{method2();}
public void method2() throws SomeException{method3();}
public void method3() throws SomeException{
throw new SomeException("SomeException occur in method3");
}
}
有Exception、IOException、、、、、、、
IOException要import java.io.IOException
你要是用eclipse编程它就会给你提示的。