java - how to use finally -


I did not understand the use of the statement at all. Can anyone tell me what is the difference between:

  try {a; Block; Close; Statement; } Hold (exception e) {handles; exception; E } Finally {do}; some; cleanliness; }  

On the one hand:

  Try {a; Block; Close; Statement; } Hold (exception e) {handles; exception; E } Tax; some; cleanliness;  

Other

They are different if

  • Try -black is completed by throwing a java.lang.Throwable which is not java.lang.Exception For example, because it is a java.lang.Error as AssertionError or OutOfMemoryError .
  • Try-block completes a sudden control flow statement like continue , break or return
  • Use of any tedious, or control flow descriptions)

More commonly, the Java language guarantees that the block is executed before the completion of the tentmember statement . (Note that if attempt-statement is not complete, then there is no guarantee about ultimately one statement can not be completed due to various reasons including hardware shutdown, OS shutdown, VM lock (for example, system's Cause) Exit ), thread wait ( threads suspend () , synchronize , Object.wait () , Thread .leep () ) or otherwise busy (endless loops, ,,,).

So, a ultimately block is a better place for clean-up actions. The method can not guarantee cleanup exeuction from the end of the body, but in itself, still.


Comments

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -