Total WebSite Views Count

Finally Block

What is the use of the finally block? Is finally block in Java guaranteed to be called? When finally block is NOT called?

  • The finally block always executes when the try block exits. 
  • This ensures that the finally block is executed even if an unexpected exception occurs. 
  • But finally is useful for more than just exception handling — it allows having cleanup code accidentally bypassed by a returncontinue, or break
  • Putting cleanup code in a finally block is always a good practice, even when no exceptions are anticipated.

  • If the JVM exits while the try or catch code is being executed, then the finally block may not execute. 
  • Likewise, if the thread executing the try or catch code is interrupted or killed, the finally block may not execute even though the application as a whole continues.

AWS Services

AWS Services

Technology Selection & Evaluation Criteria

Technology Selection & Evaluation Criteria

Scale Cube - Scale In X Y Z Cube

Scale Cube - Scale In X Y Z Cube

Feature Post

AWS Services

About Me

About Me

Spring Cloud

Spring Cloud
Spring Cloud

Spring Cloud +mCloud Native + Big Data Archittect

Spring Cloud +mCloud Native + Big Data Archittect

ACID Transaction

ACID Transaction

Data Pipe Line Stack

Data Pipe Line Stack

Popular Posts