Java Summary-Chapter 4

Source: Internet
Author: User

Chapter 4
Operators, expressions, and Flow Control
Variable is used to record variable data.
Java variables must be declared and initialized before use.
The member variables are declared in the class definition.
Create related member variables while creating objects
After a member variable is created, the system automatically initializes it by default and explicitly initializes it. The member variables are attached to objects.
& | OR = value assignment operator
Branch statement
If else
Int I;
Switch (I) // The I in case must be a numerical value and cannot be a value range.
{If the value range is required, the entire table can be divided by logarithm.
Case:
Operation;
Break;
Case:
Operation;
Break;
Default:
Operation;
Break;
}
}
The switch expression must return int, byte, Char, and short values;
The value required by the case clause must be a constant.
Break is used to exit the switch statement block after executing a case Branch.
Loop statement
For
While
Do/while
The break statement is used to terminate the execution of a statement block and terminate immediately.
The coninue language is used to skip one execution of a loop statement block.
Immediately jump out of this statement block and continue the loop

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.