Java series (4)-computing and java Series
1. Operators
(1) Arithmetic Operators
A: +,-, *,/, %, ++ ,--
B: + usage
[A. addition]
[B. Positive id]
[C. Pay for string connection]
C: // and %
[When data is used for Division,/gets the quotient and % gets the remainder]
D: ++ and -- Usage
[A. When used separately: the results are the same as those after the operation data, and the effects of a ++ or ++ a are the same]
[B. when involved in the operation-before the operation: First Auto-increment or auto-increment, then participate in the operation]
[C. when involved in Operation operations-placed behind the operand: First involved in the operation, then auto-increment or auto-subtraction]
(2) value assignment operator
A: =, + =, * =,/=, % =
B: = It is called the value assignment operator.
C: Extended value assignment operator features
(3) Comparison Operators
A: = ,! =,>, >=, <, <=
B: No matter what operations are performed on both ends of the operator, the final result is of the boolean type.
C: Do not write = As =
(4) logical operators
A: &, | ,!
[&: The result is the same as &, but it has a short circuit effect. False on the left and no execution on the right]
[|: The result is the same as |, but it has a short circuit effect. True on the left and no execution on the right]
【! : False if not true, true if not false]
B: logical operators are used to connect operators of the boolean type.
(5) bitwise operators
A: To perform bitwise operations, first convert the data to binary.
B: &, |, ^ ,~
[&: False]
[|: True if yes]
[^: Bitwise XOR operation. If the bitwise XOR operation is the same, false is used. If the bitwise XOR operation is different, true is used]
【~ : Bitwise Inverse Operator: 0 to 1, 1 to 0]
C: <, >>, >>
[<: Left shift, left highest bit discard, right fill 0]
[>: The highest bit in the right direction is 0, the left side is 0, the highest bit is 1, and the left side is 1]
(6) ternary Operators
A: Format
[Comparison expression? Expression 1: expression 2]
B: Execution Process
[Calculate the value of the comparison expression first. If it is true, expression 1 is executed; otherwise, expression 2 is executed]
2. keyboard entry
3. Process Control statements
(1) The ordered results are executed from top to bottom.
(2) Select the structure and execute different codes according to different options.
(3) duplicate code in the Loop Structure