What is try-with-resources in java?
Answers
Answered by
1
The try -with-resources statement is atry statement that declares one or more resources. A resource is an object that must be closed after the program is finished with it. ... Any object that implementsjava.lang.AutoCloseable , which includes all objects which implementjava.io.Closeable , can be used as aresource.
Answered by
0
The try-with-resources statement is a try statement that declares one or more resources. A resource is an object that must be closed after the program is finished with it. The try-with-resources statement ensures that each resource is closed at the end of the statement. Any object that implements java.lang.AutoCloseable, which includes all objects which implement
Similar questions