Tag: 不可达代码

为什么是一个简单的布尔没有给出“不可达代码”错误的if / else if / else?

为什么这段代码没有提供“无法访问的代码”错误? 由于布尔值只能是true或false。 public static void main(String args[]) { boolean a = false; if (a == true) { } else if (a == false) { } else { int c = 0; c = c + 1; } }