Java Programming thought notes (Control execution flow)

Source: Internet
Author: User

1.true and false: Java does not allow us to use a number as a Boolean value. If you want to use a non-Boolean value in a Boolean test, the if (a) must first be converted to a Boolean if (a!=0) with a conditional expression.

2.if-else:

3. Iteration:while, Do-while, for (the variable c is defined where the program uses it, that is, in the control expression for the For loop, not in the place where main () begins. The scope of C is within the range of the for-control expression) the comma operator (by using the comma operator, you can define multiple variables within the FOR statement [the only place to use])

4.Foreach Syntax:for (float x:f)//This statement defines a variable x of type float, and then assigns the element of each F to X.

5.return: on the one hand, specify what value a method returns (assuming it has no void return value), on the other hand it causes the current method to exit and return that value.

6.break and Continue:

7.goto: A reserved word for Java, but it is not used in the language; Java has no goto

8.switch: a neat way to implement multiple choices; requires a selection factor, and must be an integer value such as int and char.

Java Programming thought notes (Control execution flow)

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.