this is my code.
boolean checkHit2() {
if (cx < 0 || cx >= 640) {return true;}
if (cy < ground[(int)cx]) {return false;}
if (cx < blue +
"This method must return a result of type boolean"
Means your method should return the boolean
value for every case. Currently it will return boolean
if one of your if condition is true
. What about if none of your if condition is true
? In this case compiler will not be able to return anything to the caller of the method. So that compiler is telling you to add a return
statement for method for every case no matter condition satisfy or not. You should add return false
at the end of the method.