作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
最佳答案
不,||
使用所谓的 short-circuit evaluation ,也称为最小评估,并且一旦找到计算结果为true
(从左到右)的表达式,就会停止评估条件。
来自JLS :
15.24. Conditional-Or Operator ||
The conditional-or operator || operator is like | (§15.22.2), but evaluates its right-hand operand only if the value of its left-hand operand is false.
&&
的操作方式类似:
15.23. Conditional-And Operator &&
The conditional-and operator && is like & (§15.22.2), but evaluates its right-hand operand only if the value of its left-hand operand is true.
关于java - 使用 OR 运算符时它是否运行两个参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12141481/
我是一名优秀的程序员,十分优秀!