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:
https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html#:~:text=Note%3A%20A%20try%20%2Dwith%2D,resources%20declared%20have%20been%20closed.