Question: Explain the concept of 'try-with-resources' in Java.Answer: 'try-with-resources' is a feature introduced in Java 7 to automatically close resources like files or sockets when they are no longer needed.Example:
|
Is it helpful?
Yes
No
Most helpful rated by users: