There are only two types of Java: underlying type, reference type
8 Basic type: byte short int long float double char Boolean, where byte type takes value range " -2^7~2^7-1", Short type
The value range is " -2^15~2^15-1", and the int type takes the value range " -2^31~2^31-1"
Defines a long type, habitually after the number plus L
Defines the float type and habitually adds F after the number
☆ Forced Conversion syntax
Small type variable name = (small type) large type value.
There may be an overflow phenomenon
Operators: Arithmetic operators, logical operators, relational operators, assignment operators, trinocular operators
There are only 3 types of code structures in Java: branching, sequential, and looping structures
Add: + can be a stitching symbol
Branch structure: If-else switch-case
switch (integral type) {
Case value 1: expression 1;
Case value 2: Expression 2;
Case Value 3: Expression 3;
....
}
★ If a branch is satisfied, the subsequent branch will be executed even if it is not satisfied.
Case value 1 is satisfied, expression 1 executes,
Case value 2, value 3 even if not satisfied, expression 1, expression 2 will also be executed.
The Break keyword
You need to use the break keyword under a specific (satisfied) branch structure.
Default keyword
At the end of the Switch-case branch, the default branch operation is added.
If all branches above default are not satisfied,
The code in the default will be executed.
Only integer, enum, in switch ().
Three elements of the loop:
Declaration initialization of variables, condition control, conditional judgment
Loop structure: While, for, Do-while
The Break keyword
Break: Exit, interrupt.
Used in a loop, expressed as exiting the current loop.
Continue: Skip this cycle
Two-dimensional loops: There are rows and columns when you think of 2 cycles
Second:for () {
First:for () {
break;//will only exit the first layer loop
Break second;//jumps directly out of the two-layer loop.
}
}
Java Basics Review (2)