adplus-dvertising
frame-decoration

Question

What is the output of below snippet?
try (InputStream is = ...) 
{
    // do stuff with is...
} 
catch (IOException e) 
{
    // handle exception
}

a.

Runtime Error

b.

IOException

c.

Compilation Error

d.

Runs successfully

Answer: (d).Runs successfully

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of below snippet?

Similar Questions

Discover Related MCQs

Q. It is a good practise to not throw which exception in close() method of autocloseable?

Q. Which of the below is a child interface of Autocloseable?

Q. What is the alternative of using finally to close resource?

Q. Autocloseable was introduced in which Java version?

Q. What does foo.getClass().getMethod(“doSomething”, null) return?

Q. What does Class.forName(“myreflection.Foo”).getInstance() return?

Q. How to get the class object of associated class using Reflection?

Q. How method can be invoked on unknown object?

Q. What is used to get class name in reflection?

Q. How private field can be called using reflection?

Q. How private method can be called using reflection?

Q. What is not the advantage of Reflection?

Q. Which of the following is not a marker interface?

Q. What are the components of a marker interface?

Q. Which of the following is not a directive in JSP?

Q. Java code is embedded under which tag in JSP?

Q. Can <!–comment–> and <%–comment–%> be used alternatively in JSP?

Q. Which tag is used to set a value of a JavaBean?

Q. What temporarily redirects response to the browser?

Q. Which object stores references to the request and response objects?