First, the underlying data type (four classes of eight): cannot be null
Integer type
BYTE----2 of 8 square
Short----2 of the 16-time Square
int----2 of the 32-time Square
Long----2 of the 64-time Square
Floating point Type
FLOAT----4 x
Double---8 bytes
Boolean type
Boolean (True, False)
Character type
Char (can be a letter, or it can be a Chinese character)
int a = 5;
Save All to Stack
Reference type: String s = "abc";
All the classes
All the arrays
All the interfaces
Second, branch
if (expression _ Boolean value) {
...
}
if (expression _ Boolean value) {
...
} else {
...
}
if (expression _ Boolean value) {
...
} else if (expression _ Boolean value) {
...
}
if (expression _ Boolean value) {
...
} else if (expression _ Boolean value) {
...
} else {
...
}
int a = 2;
Switch (a) {
Case 1
...
Break
Case 3
...
Break
Case 5
...
Break
Default
...
}
Branching and looping
if () {
}
if () {
}else{
}
if () {
}else if () {
}
if () {
}else if () {
}else
Switch (a) {
Case 1
...
Break
Case 2
...
Break
Case 3
...
Break
}
Iii. the difference between if and switch
Cycle
for (int i=0; i<10; i++) {
...
}
while (loop condition) {
}
do{
}while (); This cycle loops at least once.
Java Branching and looping