I have a for
loop that returns values from an array.
public static String getPieces(){
for(int y=0; y<=7; y++)
for(int x
because return statement is under for
block.
As you have mentioned return type is String and your method has to have return tye. But with your program compiler does not know in advance that flow does not go under for loop and no return is possible. So compiler is extra smart. Is n't it :)
Try
public static String getPieces(){
String result = null;
for(int y=0; y<=7; y++)
for(int x=0; x<=7; x++)
result= piece[x][y];
return result;
}
it will work