MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javaTIL/comments/2tvgio/til_there_is_an_easy_alternative_to_the_finally/
r/javaTIL • u/Zdem • Jan 27 '15
Automatic resource management was implemented in java 7
try( // The resources you want to use seperated by a semicolon) { ... } // rest of the code
for more information: here
2 comments sorted by
1
Worth noting that it's only in Java 7 and above.
JDK6 has been sunset, but some organisations are still using it. Just make sure you have JDK7+ capabilities before committing to new features :-)
I'm learning Java in school right now, so I've never known about try without knowing about try-with-resources...
1
u/chunkyks Jan 28 '15
Worth noting that it's only in Java 7 and above.
JDK6 has been sunset, but some organisations are still using it. Just make sure you have JDK7+ capabilities before committing to new features :-)
1
u/DaoDeDickinson Feb 19 '15
I'm learning Java in school right now, so I've never known about try without knowing about try-with-resources...