The while of the Java Loop statement

Source: Internet
Author: User

In life, there are times when we need to repeat certain actions in order to accomplish a certain task. For example, we take a 10000-metre long run and need to go 25 laps around a 400-metre track. When implementing this functionality in Java, it is often necessary to repeatedly execute some code, for example, in order to express "determined determination", we want to output 1000 lines "I want to learn java! ”。 Obviously, let us repeatedly knock out 1000 times the output statement is not reliable!!! Then, we'll use our loop statement at this point.

3 types of loops commonly used in Java: While, Do...while, for

First, let's take a look at while

Grammar:

<1>: First of all, let's determine if the condition after the while is true (True/false)

<2> If the condition is true, the loop operation is performed

<3> then repeat <1>, <2> until the loop condition is not established.

Features: first judgment, after execution.

The while of the Java Loop statement

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.