public class Rethrowing {
public static void f() throws Exception {
System.out.рппШССоздание исключения в f(D; throw new Exception ("возбуждено из f(D;
}
public static void g() throws Exception { try {
f().
} catch(Exception e) {
System, out. pri ntl n("B методе g(), e printStackTraceO"). e printStackTrace(System.out); throw e,
}
}
public static void h() throws Exception { try {
f():
} catch(Exception e) {
System out.printlnC'B методе h(), e.printStackTrace()"),
e printStackTrace(System.out),
throw (Exception)e fill InStackTraceO,
}
}
public static void main(String[] args) { try {
go.
} catch(Exception e) {
System, out pri ntl n( "main- printStackTraceO"). e.printStackTrace(System out);
}
try {
hO.
} catch(Exception e) {
System out.printlnCmairr printStackTraceO"); e printStackTrace(System out);
}
}
} /* Output