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");
}
}
各位大虾帮忙看看哪里有错,编译通不过,我是初学者,请不吝赐教!!
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");
}
}
class SomeException extends Exception{
public SomeException(String msg){
super(msg);
}
public SomeException(Throwable e){
super(e);
}
}
public class ExceptionTest {
public static void main(String[] args) {
ExceptionTest test = new ExceptionTest();
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");
}
}class SomeException extends Exception {
SomeException(String s) {
System.out.println(s);
}
}
[/code这是不是你要的? 说实话没看懂你问的是什么
SomeException() {
}
SomeException(String str) {
super(str);
}
}