Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我看到一段这样的java代码:
int y = 100; boolean x = y <= 0; System.out.println(x);
<=由于这种使用方式对我来说很奇怪,有人可以在<=这里解释一下,我该如何使用它?
<=
赋值运算符在 Java=中的优先级低于<=,因此<=首先执行。的boolean结果y <= 0分配给x。它可以写得更清楚:
=
boolean
y <= 0
x
boolean x = (y <= 0);
但是效果是一样的。
读作:
这意味着: