So I'm trying to check if the new coordinates vs original coordinates are diagonal and 1 line further, and if there is a piece there(getNum()) if it's 2 lines further, so I'm trying to return a boolean value then.
so if it's the first if, it returns true, if it's the 2nd it returns true, then I say else for all other scenario's, and return false there, but my
compiler says my method is missing a return statement.
Where did I go wrong?
Thx
public boolean check(int[] d) { int x,y; x = loc[0][0]; y = loc[0][1]; int sx = d[0]; int sy = d[1]; if((sx == x+1)) { if((sy == y +1) || (sy == y-1)) { return true; } } else if((sx == x+2)) { if((buttons[sx-1][sy-1].getNum() == true) || (buttons[sx-1][sy+1].getNum() == true) ) { return true; } } else { return false; } }
Edit: used a local boolean and returned that after my if's.,