Finally statement block in Java exception

Source: Internet
Author: User

About the finally statement block

The 1.finally statement block can be directly associated with a try statement block. Try....finally ...

2.try...catch....finally can also.

3. The code in the finally statement block is bound to be executed.

4. If you exit the jvm,finally statement block before executing the finally statement block, it will not execute.

public class Exceptiontest08{public static void Main (string[] args) throws Exception{/*try{system.out.println ("ABC"); return;} Finally{system.out.println ("Test");} *//*try{fileinputstream fis = new FileInputStream ("Test.java");//Do not execute System.out.println ("Tttt");} finally{//will execute System.out.println ("AAAAA");} *///If you exit the JVM before the finally statement block is executed, the finally statement block does not execute. try{//exit Jvmsystem.exit (0); finally{//will not execute. System.out.println ("finally ....");}}


This article is from the "Gaogaozi" blog, make sure to keep this source http://hangtiangazi.blog.51cto.com/8584103/1661700

Finally statement block in Java exception

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.