标签: java oop inheritance if-statement while-loop
以下代码给出了编译时错误 - 无法访问的语句
while(true) return; return; // Unreachable statement
但是,以下代码不会出现任何错误:
if(true) return; return; // Reachable, No Error
我无法理解为什么编译器会识别出在while的情况下,永远不会达到第二个return语句,但在if的情况下它不会识别相同的语句?