Java for loop execution sequence

Source: Internet
Author: User

For (INT I = 0; I <2; system. out. println (I) <br/>{< br/> system. out. println (I); </P> <p>}Don't talk about anything. First, the last two sections of code

1. code snippet 1

2. code snippet 2For (INT I = 0; I <2; system. out. println (I = I + 1) <br/>{< br/> system. out. println (I); </P> <p>}

The two codes clearly describe the features of the For Loop execution:

If the third expression of the for loop is related to the value assignment of the variable defined in the first expression, it will be executed at the end of the statement block. If not, it will be executed first in the statement block.

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.