0

What does the finally keyword do?? :D

26th Sep 2016, 11:44 AM
MM1132
MM1132 - avatar
4 ответов
+ 4
Finally, will run no matter what even if there is an error or not, unlike that of catch.
26th Sep 2016, 11:49 AM
Don
Don - avatar
+ 2
The finally block is executed no matter what, exception or not. It's very useful to make sure that streams are always properly closed in the end, for example.
26th Sep 2016, 11:56 AM
Zen
Zen - avatar
0
OK. So what's the point of it?? If I don't use finally and write the stuff outside the try catch. It will run with no problems :D
26th Sep 2016, 11:53 AM
MM1132
MM1132 - avatar
0
what?? :D
26th Sep 2016, 11:59 AM
MM1132
MM1132 - avatar