I was using try..finally code but I want to use try with resource but I am not sure how to call a method in try with resource can anyone help me with that?
using try finally
try{
}
catch{}
finally{
//closed a resources
//called a methods
reportAbc();
}
using Try with resource
try(){
}
catch{}
but I am not sure how should I call reportAbc() method without using finally.
This is from the documentation:
Note: A try-with-resources statement can have catch and finally blocks just like an ordinary try statement. In a try-with-resources statement, any catch or finally block is run after the resources declared have been closed.