Java variables && Simple program flow && loops

Source: Internet
Author: User

Variable: strongly typed
Local variables:
1. Assign values first, then use
2. Scope of action: Starting from the definition, to the end of the block of code
3. Duplicate naming is not allowed in coincident range

Data type (basic type in 8)
BYTE 1b-128~127
Short 2b-32768~32767
int 4 b
Long 8B L or L
Float 4 B F or F
Double 8B D or D does not add
Boolean 1 B True False
Char 2B ' A '
Object type
String "hehe"
Forced conversions
int a= (int) 12.5;
Automatic type Promotion
A b look there is no double ===>double
There is no float====>float
Is there a long ===>long
There's no ====>int.
Operator:
= assignment operator int a=2;
+ - * / %
+ = = *=/=%= a>b?a:b
+ +--a++ ++a
> < >= <=! = = =

Simple program Flow:
Program Flow
Sequential process
Conditional branching Process
if (Boolean expression) {}
if () {}else{}

switch (expression) {byte int short char String (1.7)
Case value 1;break;
Case value 2;
....
Default

}

Cycle

while (Boolean type) {} 0-n
do{Loop Body}while (Boolean type) 1-n
For (initialization of the loop variable; boolean type expression; change of loop variable) {}
Break jumps out of the loop
Continue jump out of this cycle

Java variables && Simple program flow && loops

Related Article

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.