public MyObject method1() {
boolean someBoolean = true;
MyObject obj = ...;
if(!someBoolean) method1();
else return obj;
// flow should never come to this statement, but compiler requires this return. why?
return null;
}
Run Code Online (Sandbox Code Playgroud)
为什么java编译器需要最终的return语句?
-Prasanna
归档时间: |
|
查看次数: |
104 次 |
最近记录: |