I see that try-with-resources is available to any class that implements the AutoCloseable
interface.
public interface AutoCloseable {
void close() throws Exception;
}
Is that the only criteria for a class to support try-with-resources in Java (I meant, are there any possible scenarios where a class doesn't implement AutoCloseable
interface but supports try-with-resources)?