Compile time Error
No. 273
|
Q: |
We consider: Why does the compiler complains about a “Missing return statement” despite several being present? |
|
A: |
The if-clause is incomplete: A final
“ String getResult(int a, int b) {
if (0 == a % 2) {
return "o.K.";
} else if (a + b < 0) {
return "Quite o.K.";
} else if (4 < a * b) {
return "bad";
}else {
return "Schlecht";
}
} |
