Branch structure (if...else, switch)
1. If Else statement format
if (conditional expression) {Execute code block; } Elseif(conditional expression) {Execute code block; } Else{execute code block; }
2. Switch statement
Switch(variable) { Caseconstant Value 1: statement 1; Break; Caseconstant Value 2: statement 2; Break; Caseconstant Value 3: Caseconstant Value 4: Caseconstant Value 5: statement 5; Break; default: statement; Break; }
"Knowledge points":
A) switch: When the values of multiple variables go through the same process, you need to follow the notation of constants 3, 4, and 5 to merge cases.
b) If else and switch differences?
If else is suitable for interval comparisons, for example: greater than 60 less than 80 for qualifying, etc.
switch is suitable for specific equivalents. For example: water temperature of 100, indicating that the waters opened,
loop structure (while, Do...while, for )
"Knowledge points"
For format:
1. Initialization conditions
2. Cyclic conditions
3. Iteration Conditions
4. Circulation body
for (1;2;3) {
4
}
Execution order: 1-2-4-3-2-......-4-3-2
Until the loop condition is not satisfied, exit the current loop
Interview Title: Output 99 multiplication table
for (int i = 1;i<=9;i++) { for (int j = 1;j<=i;j+++ "*" +i + "=" + I * J + "\ T"); } System.out.println (""); }
While format:
while (2) {
4
3
}
Do...while format:
1
bo=
4
3
}while (2)
Break and continue tags are used:
And then brother combed the Java Knowledge Point--Process Control (VI)