What is the result? Given: What is the result? Given: What is the result? A. Option A B. Option B C. Option C D. Option D Explanation: Show Hint ← Previous question Next question →
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”); } } Reply
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”);
}
}