Basic knowledge of Java operators

A basic arithmetic operators
basic arithmetic operator comprising: a plus (+), subtract (-), multiply ( ) , divide (/), a die (%)
Note: modulo (%) only for integer division modulo number but also for floating point numbers. (In C / C ++ in% modulus operator only for integer type).
Second relational operators
relational operators are: ==, =, <,>, <=,> =!
Note: Expression relational operators return values are the boolean type.
Three logical operators
common logical operators are: &&, || ,! , &, | (And wherein & | not recommended)
logical operations return value is boolean type.
"||" and "&" operator is short-circuited, "&" and "|" non-shorting operator. Boolean expression for operator-circuit is always executed on both sides of the operator; operator for short circuit, if the entire expression can calculate Boolean expressions according to the Boolean operator breaks the left, to the right of the operator's operation is not performed Boolean expressions formula.
. Four operators
are: bitwise (~), bitwise AND (&), bitwise OR (|), bitwise exclusive or (^)
bit arithmetic operation represented by bits.
V. Shift operators
shift operators are: left shift operator (<<), right-shift operator (>>), unsigned right shift (>>>)
left <<: the left-most do not, rightmost 0s.
>> right: the right side of most do not, fill the leftmost sign bit (positive complement 0, negative S.1).
>>> unsigned right: the right side of most do not, the leftmost 0s.
VI. The conditional operator
expression1? Expression 2: Expression 3
When Expression 1 is true, the entire expression is the expression value of 2; and when Expression 1 is false, the entire expression is the expression value 3.

Guess you like

Origin blog.51cto.com/14298563/2438423