Given:
You want to use the myResource class in a try-with-resources statement.
Which change will accomplish this?
Given:
You want to use the myResource class in a try-with-resources statement.
Which change will accomplish this?
To use the MyResource class in a try-with-resources statement, you must implement the AutoCloseable interface and override the close method. Implementing AutoCloseable ensures that MyResource can be used in the try-with-resources statement and properly closed at the end of the statement.
D is true.