I’ve seen reference in some C# posted questions to a ‘using’ clause. Does java have the equivalent?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes. Java 1.7 introduced the try-with-resources construct allowing you to write:
… just like a
usingstatement.Unfortunately, before Java 1.7, Java programmers were forced to use try{ … } finally { … }. In Java 1.6: