Questions tagged as 'try-with-resources'

3
answers

Method close () in try and catch blocks is required?

I'm studying Java with database and after seeing a little more about this close() method and this protected block, I was a bit confused, because in some codes and articles I see that close() was not used in try / catch blocks becau...
asked by 25.07.2018 / 15:33
2
answers

Is there a try-with-resource in PHP?

Is there something like PHP try with resource in Java? Or do I have to close resources in the block of finally same?     
asked by 02.10.2018 / 05:03
0
answers

Unit Testing - How to test a try-with-resources?

I'd like to know the best way - or the standard way - to test a try-with-resources ; with Test Cases for each of the Exceptions that can be released (simulating the launch of each of these Exceptions to see how the tested code will behave), and...
asked by 17.03.2018 / 03:16
1
answer

Rewrite code using the try-with-resources feature [duplicate]

My problem is to rewrite a code using the try-with-resources feature, as I'm new to the programming world, I'm not able to learn how to do this, which is becoming rather overwhelming because it's apparently simple but I'm not getting it. I...
asked by 25.12.2016 / 16:02