What is the result?

Given:


What is the result?


A. Option A
B. Option B
C. Option C
D. Option D

Download Printable PDF. VALID exam to help you PASS.

One thought on “What is the result?

  1. Option D.

    public class Test {
    public static void main(String[] args) {
    Test t = new Test();
    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”);
    }
    }

    Output:
    Caught java.lang.RuntimeException: Exception

    Note:
    The IDE doesnt understand “import java.io.Error” the closest working import would be “java.io.IOError” though this doesnt seem to influence the Output above?

Leave a Reply

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


The reCAPTCHA verification period has expired. Please reload the page.