1.

Explain The Purpose Of Try-with-resource Statement?

Answer»

The try-with-resources statement is a try statement with one or more resources duly declared. Here resource is an OBJECT which should be closed once it is no more REQUIRED. The try-with-resources statement ensures that each resource is closed after the requirement FINISHES. Any object implementing java.lang.AutoCloseable or java.io.Closeable, interface can be USED as a resource.

The try-with-resources statement is a try statement with one or more resources duly declared. Here resource is an object which should be closed once it is no more required. The try-with-resources statement ensures that each resource is closed after the requirement finishes. Any object implementing java.lang.AutoCloseable or java.io.Closeable, interface can be used as a resource.



Discussion

No Comment Found