This method must return a result of type boolean(Java) -
this code.
boolean checkhit2() { if (cx < 0 || cx >= 640) {return true;} if (cy < ground[(int)cx]) {return false;} if (cx < blue + 15 && cx > blue - 15) { score = (int)score + 1; what doing wrong? gives me error message "this method must return result of type boolean". please help.
"this method must return result of type boolean"
means method should return boolean value every case. return boolean if 1 of if condition true. if none of if condition true? in case compiler not able return caller of method. compiler telling add return statement method every case no matter condition satisfy or not. should add return false @ end of method.
Comments
Post a Comment