What is the purpose of try with resource block in java. I understands that it takes an AutoCloseable object reference like Inputstream, which it case close .
I want to know what the advantage of this construct. The same we are able to achieve by closing resources in finally block.
try(? extends AutoCloseable){
}