May change value;
Variable declaration:
(1) in the statement of the assignment at the same time; For example: int a=4;
(2) the first statement in the assignment; For example: int a; A=4;
Variables can be divided into local variables and member variables;
2: data types (four categories, eight kinds of)
1. The integer
Byte type: byte
Short integer: short
Integer: int
Long, long
Floating-point
Float (single precision)
Double (double)
Character
Char (for a single character)
More characters String (said)
The Boolean
True | false
Three: operator
1. The arithmetic operators: +, -, *,/, %, + +, -
2. The comparison operators: & lt; , & gt;==, & lt;=, & gt;=;
3. The conditional operator:
Grammar: expression? Value 1:2;
Um participant
Int I=3;
//calculate whether I & gt; 0
String s=i> 0? "I> 0 ":" i<0 ";
4. Logical operators
Logical operators operands are of value to a Boolean expression of type, the results are the result of the Boolean type
& : both sides to true is true, is a false false
| : one is true is true, both to false is false
! Get back! True - & gt; False! False - & gt; True
4: process control statements
1. The sequence structure
2. Select structure
If statement
Syntax
1. The single choice:
If (condition) {
Meet the conditions can be executed statement
}
Int I=10;
If (i> 0)
System. Out.println (" i> 0 ");
2. Double choose
If (condition) {
Statements 1
} else {
Statements 2
}
Eg: int a=18;
If (a> 10) {
System. Out.println (" a> 10 ");
} else {
System. Out.println (" a<10 ");
}
More than 3. Select
If conditions (1) {
Statements 1
{2} else if (condition)
Statements 2
} else {
Statement 3
}
CodePudding user response:
Go learn w (? Д?) wCodePudding user response:
CodePudding user response:
CodePudding user response: