All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.
Apparantly the answer is supposed to be "It will throw an exception at runtime", which I can agree with given that the code would compile. However, the first statement "Connection c = ...." is outside the try-with-resources statement and will result in a compiler error unless the statement is moved inside the try-with-resources parantheses thingy, or if the surrounding method throws SQLException, which is not specified in the text.
The code will not compile even if you move it inside the try block because it is not complete code. There is no encompassing method or class for it to compile and run.
In such cases, where you see partial code listing, you need to assume that the given code is present in appropriate context of a method/class. In this case, the encompassing method can be assumed to have appropriate throws clause.
The method rsmd.getColumnName(0) will throw SQLException, witch must be cached by the catch block. So it will handle it, print stackTrace but and application will not throw any exception and will finish correctly, isn't?