elibraryportal Logo

Finally Block

→ It always executes.

→ It must be preceded by try or catch.

→ Finally Block is used to place the important code such as closing connection, closing stream etc.

Example1

Output :-

Finally Block Example

Example2

Output :-

Finally Block Example
Next Topicthrow Keyword