Operators in Java:
Arithmetic operators: +,—, *,/(except for rounding),% (modulo redundancy), + + (self-increment),—— (self-decrement)
Negative operator: =,+=,-=,/=,%=
Relational operators: The >,<,>=,<=,==,!= relational operator is a comparison of the operands on both sides, and the result is always Boolean
Logical operator:! , &,|,^,&&,| |
Bitwise operator::&,|,^,~,>>,<<,>>>
String Join operator: + In addition to being used to concatenate strings, you can also concatenate strings with other data types into a new string such as String s= "X" + 123
Trinocular operator: X? Y:z
X is a Boolean expression that evaluates the value of x first, and if true, the result of the entire trinocular operation is the value of the value of the expression y otherwise Z.
such as: int score=45;
String type=score>=60? " Pass ":" Failed ";
An expression
1. An expression is a sequence of operators and operands that conform to a certain grammatical rule
2. Type and value of an expression
The result of operations on operands in an expression is called the value of the expression
The data type of the value of the expression is the type of the expression
3. Order of operation of expressions
You should first follow the precedence of the operators from highest to lowest
Operators with the same precedence are performed in a pre-agreed binding direction
Java-language operators and expressions