Java-preliminary Understanding-Chapter III-Exercise of the cyclic structure 2

Source: Internet
Author: User

I. Exercises for the loop structure while statement

Note: While statements are written in the same way as the IF Format 1, the only difference is that the keyword is different from the beginning. In the video explanation, the criterion of the two conditional statements is the same, the final output is the Boolean type of data.

What we want to explore now is what constitutes the conditional expression in the IF statement of the structure, the switch statement that chooses the structure, and the loop structure in the while statement?

We know that the final output in the conditional expression of the IF statement is a Boolean type of data, but the composition of the expression is in several forms, with the assignment operator participating (if x==3) and the interval form (the composition of the interval is also a comparison operator and a logical operator). There can also be direct Boolean data.

The IF condition statement is directly false, showing that the program has no action on the IF statement. Without judgment, of course, the IF statement is not executed.

The conditional expression of switch is numeric, which shows the difference from If,while. The switch conditional expression finally gets a numeric data, and If,while gets a Boolean type of data that may be expressed in the same form but with different results (?). ),

Java-preliminary Understanding-Chapter III-Exercise of the cyclic structure 2

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.