Leave a Reply 1

Your email address will not be published. Required fields are marked *


renko

renko

Output:
Caught java.lang.RuntimeException: Exception

code Question:
import java.io.IOException;

public class TestApp {
public static void main(String[] args) {
TestApp t = new TestApp();
try {
t.doPrint();
t.doList();

} catch (Exception e2) {
System.out.println(“Caught “+ e2);
}
}
public void doList() throws Exception {
throw new Error (“Error”);
}
public void doPrint() throws Exception {
throw new RuntimeException (“Exception”);
}
}