Postfix operators [] . (parameters) expression++ expression--
Unary prefix operators ++expression --expression +expression -expression ~ !
Unary prefix creation and cast new (type)
Multiplicative * / %
Additive + -
Shift << >> >>>
Relational < <= > >= instanceof
Equality == !=
Bitwise/logical AND &
Bitwise/logical XOR ^
Bitwise/logical OR |
Conditional AND && //here
Conditional OR || //here
Conditional ?:
Assignment = += -= *= /= %= <<= >>= >>>= &= ^= |=
这是在 kalid A Mughal & Rasmussen 书中发表的运算符优先级
根据本书&&
的优先级高于||
但以下代码
if(true&&false||true)
{
System.out.println("yes");
}
此代码打印"yes"
。表示首先执行"||"
这本书错了吗?或者我的解释错误。