I am looking for a Java equivalent for python's with statement, and I read about implementing the AutoCloseable interface and using try with resources.
In python, the context manager (with statement) uses two methods: __enter__ and __exit__, but in Java, the try with resources block uses only close, which is the equivalent of __exit__.
Is there an equivalent for the __enter__ method, in order to perform a certain method automatically when entering the try with resources block, and not only when the block is over?