Lets suppose we have function like:
private int x() {
while(true) {
if(true) {
} else {
return 0;
}
}
}
why Java compiler compiles such kind of code without error message ("Missing return statement"). Such kind od code will compile and never stops during execution.
In comparision, following code will not compile ("Missing return statement"):
private int y() {
if(true) {
} else {
return 1;
}
}