1. Operators
(1) Arithmetic operators
a:+,-,*,/,%,++,--
The use of b:+
"A. Addition"
"B. Plus"
"C. String Connection Payment"
The difference between c:/and%
"When the data is division, the quotient is taken, and the remainder is taken."
The use of d:++ and--
"A. When used alone: put in front and back of the operating data the effect is the same, a++ or ++a effect is the same"
"B. Participate in operation Operations-put in front of operand: increment or decrement first, then participate in operation"
"C. Participate in the operation of operations-placed after the operand: first participate in the operation, and then self-increment or decrement"
(2) Assignment operator
a:=,+=,*=,/=,%=
B: = is called an assignment operator
C: Features of the extended assignment operator
(3) Comparison operators
a:==,!=,>,>=,<,<=
B: The end result is a Boolean type, regardless of the operator's ends
C: Don't write = =
(4) Logical operators
a:&&,| |,!
"&&: The result is the same as the &, except that it has a short-circuit effect. The left side is false and the right side does not execute "
"| | : Results and | is the same, but there is a short-circuit effect. The left is true and the right side does not execute "
"!: Not true false, not false true"
B: Logical operators are used to concatenate Boolean types
(5) Bitwise operator
A: To do a bitwise operation, the first thing to do is to convert the data into binary
b:&,|,^,~
"&: false, False"
"|: Has true, then true"
"^: Bitwise XOR OR operation, same as false, difference true"
"~: Bitwise inverse Operator: 0 change to 0"
C:<<,>>,>>
"<<: Left left highest bit discarded, right 0"
">>: Right shift the highest bit is 0, the left side is 0; the highest bit is 1, the left side is 1"
(6) Ternary operator
A: Format
"Comparison expression? Expression 1: Expression 2"
B: Execution Process
"The value of the comparison expression is evaluated first, and if true, the expression 1 is executed, otherwise the expression 2"
2. Keyboard entry
3. Process Control Statements
(1) Order results from top to bottom, executed sequentially
(2) Select structure to execute different codes according to different choices
(3) Loop structure to do some repetitive code
Java Series Learning (iv)-Calculation of operations