java: After the try-catch write do not write the difference finally

I believe that after a small partner like me finally write and not write finally, try complete or catch finished, they would later perform, then the significance of what finally write it?

I understand I will be given the answer:

finally there is try to prevent the return statement occurs not close the catch something.

After testing, we found that:

  1. try there return, and to perform, and will perform the first finally finished and then return. Without directly writing finally return, not later executed.
  2. catch and return there to perform, ibid.
  3. or try and return catch which has to perform, and there was finally return, execution is finally the finally return inside.
  4. There are finally return, there finally return vitro, sorry, by the syntax.

 

Finish. 

Published 60 original articles · won praise 13 · views 20000 +

Guess you like

Origin blog.csdn.net/qq_35584878/article/details/101275980