Science, asked by aswani1644, 1 year ago

What is try-with-resources in java?

Answers

Answered by rockyak4745
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 Anonymous
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