Java 学习指南_学习Java:运算符总结

运算符总结Summary of Operators

一下快速参考总结了Java编程语言所支持的运算符。

赋值运算符

1
= 赋值 Simple assignment operator

数学运算符

1
2
3
4
5
6
+ 加法/字符串链接Additive operator (also used
for String concatenation)
- 减法Subtraction operator
* 乘法Multiplication operator
/ 除法Division operator
% 取余数Remainder operator

一元运算符

1
2
3
4
5
6
7
8
9
10
11
+ 一元正号操作,可省略Unary plus operator; indicates
positive value (numbers are
positive without this, however)
- 一元负号操作,取相反数Unary minus operator; negates
an expression
++ 自增操作,表达式值增加1.Increment operator; increments
a value by 1
-- 自减操作,表达式值减少1.Decrement operator; decrements
a value by 1
! 逻辑否操作,取反。Logical complement operator;
inverts the value of a boolean

相等及关系运算

1
2
3
4
5
6
== 等于Equal to
!= 不等于Not equal to
> 大于Greater than
>= 大于等于Greater than or equal to
< 小于Less than
<= 小于等于Less than or equal to

条件运算Conditional Operators

1
2
3
4
&& 条件与运算Conditional-AND
|| 条件或运算Conditional-OR
?: 三木运算Ternary (shorthand for
if-then-else statement 简便的if-then-else形式)

类比较运算Type Comparison Operator

1
2
instanceof 将一个对象与具体的类,接口比较Compares an object to
a specified type

位运算与位移运算Bitwise and Bit Shift Operators

1
2
3
4
5
6
7
~ 一元补码运算Unary bitwise complement
<< 有符号左位移Signed left shift
>> 有符号右位移Signed right shift
>>> 无符号右位移Unsigned right shift
& 位与运算Bitwise AND
^ 位异或运算Bitwise exclusive OR
| 位或运算Bitwise inclusive OR
Enjoy it ? Donate me ! 欣赏此文?支持一下 !