Answer:
See explaination
Step-by-step explanation:
The code here:
import java.io.*;
public class CISP401V11A5 {
public static void main(String[] args) throws Exception {
try {
CISP401Method();
} catch (Exception e) {
System.out.println("Exception thrown in " + e.getStackTrace()[0].getMethodName() + "\\");
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
String exceptionAsString = sw.toString();
String bagBegin = exceptionAsString.substring(0, 19);
String bagEnd = exceptionAsString.substring(19);
System.out.println(bagBegin + ": Exception thrown in " + e.getStackTrace()[0].getMethodName() + bagEnd);
}
}
public static void CISP401Method() throws Exception {
try {
CISP401Method2();
} catch (Exception e) {
throw e;
}
}
public static void CISP401Method2() throws Exception {
throw new Exception();
}
}
See attachment for sample output