Questions tagged [finally]

The finally block always executes after a try block, regardless of how the control exits the block.

Filter by
Sorted by
Tagged with
-1
votes
5answers
3k views

Finally block when no exceptions thrown

I'm doing some cleanup operations that could throw an exception, and I want to implement the logic of a finally block, but only if no exceptions are thrown: The initial implementation is this: ...
2
votes
1answer
348 views

Event subscription in finally clause

Background My program communicates with a device that is usually asynchronous, but can sometimes behave synchronously. I have an event handler that I use for receiving the data asynchronously, then I ...
7
votes
2answers
4k views

How to get around non-initialized objects in the `finally` block?

I like using final variables whenever possible. Often those variables have to be closed afterwards. Note that I'm currently working on Java 6 so there is not closeable interface, but the same applies ...
12
votes
5answers
2k views

What is the conceptual difference between finally and a destructor?

First, I am well aware of Why is there no 'finally' construct in C++? but a lengthy-growing comment discussion on another question seems to warrant a separate question. Apart from the issue ...
2
votes
1answer
408 views

Which programming language first came up with the finally block?

Which programming language first came up with the finally block? I ask purely out of curiosity. It is a very useful piece of syntactic sugar, and whoever first created it surely has a very ...