來源:think in java 第三章 3.1.16運算符總結
運算符英文解釋:
Arithmetic operators:算術運算符
Relational and logical: 關係和邏輯運算符
Bitwise operators: 位運算符
Compound assignment:複合賦值
Casting:類型轉換
boolean類型之間
Arithmetic operators: 不支持
Relational and logical: == ,!=,>=,<=,!,&&,||
Bitwise operators: & , | , ^
Compound assignment: &=,|=,^=
Casting:不支持
char類型之間
Arithmetic operators: *,/,% ,+,- ,++ ,–
Relational and logical: >,>=,<,<=,==,!=
Bitwise operators: ~,&,|,^,>>,<<,>>>
Compound assignment: +=,-=,*=,/=,%=,&=,|=,^=,<<=,>>=,>>>=
Casting:支持轉換的類型:除了boolean類型,都支持轉換。
byte類型之間
Arithmetic operators: 同上
Relational and logical: 同上
Bitwise operators:同上
Compound assignment:同上
Casting:同上
short類型之間
Arithmetic operators: 同上
Relational and logical: 同上
Bitwise operators:同上
Compound assignment:同上
Casting:同上
int類型之間
Arithmetic operators: 同上
Relational and logical: 同上
Bitwise operators:同上
Compound assignment:同上
Casting:同上
long類型之間
Arithmetic operators: 同上
Relational and logical: 同上
Bitwise operators:同上
Compound assignment:同上
Casting:同上
float類型之間
Arithmetic operators: 同上
Relational and logical: 同上
Bitwise operators:不支持
Compound assignment:僅支持+,-,*,/,%
Casting:同上
duble類型之間
Arithmetic operators: 同上
Relational and logical: 同上
Bitwise operators:不支持
Compound assignment:僅支持+,-,*,/,%
Casting:同上