我一直在读罗伯特·奈斯特罗姆的书《100》,我读到了下面的代码:
if (!scopes.isEmpty() && scopes.peek().get(expr.name.lexeme) == Boolean.FALSE) { // <- Focus here
// some code here
}
在我们声明变量的其他地方,这本书使用了更常用的语法boolean a = false
表示法.堆栈溢出有许多解释什么是Boolean.FALSE
的答案,但没有一个说明何时应该使用它.
在相等运算符的上下文中编写Boolan.FALSE(或Boolan.TRUE)是一种常见的/良好的实践吗?如果是,那是为什么?
或者,这是个人喜好和代码可读性的问题吗?