Java------Operators, branching structures, looping

Source: Internet
Author: User

I. Operators and expressions
1) Arithmetic: +-*/% + +--
2) Relationship:> < >= <= = = =!
3) Logic:&& | | !
4) Assignment: = + = = *=/=%=
5) String Connection: +
6) Three Mesh/condition: Boolean? Number 1: Number 2


Two. Branching structure
1) if
2) If...else
3) If...else If
4) Switch...case
Advantages: Clear structure and high efficiency
Cons: Integers, equal
Break: Jump out of switch

Three. Cyclic structure
1. Cyclic three elements:
1) Initialization of cyclic variables
2) Conditions of the loop (based on the cyclic variable)
3) changes in cyclic variables (toward the end of the cycle)
Cyclic variable: The amount of change in the loop process
2. Loop structure:
1) While: first judgment after execution, it is possible not to execute at once
2) Do...while: First execution after judgment, at least once
Tip: When the 1th element is the same as the 3rd element, the preferred
3) for: Highest application rate
3. Break: Jump out of the loop
Continue: Skips the remaining statements in the loop body and goes to the next loop

Contrast:

1) Sequential structure: Execute from top to bottom, every sentence must go
2) Branching structure: Conditional execution of a statement once, not every sentence must go
3) Loop structure: Conditional execution of a statement multiple times, not every sentence must go

Java------Operators, branching structures, looping

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.