[SOLVED] return statement
Hi all again, i seem to have many issues today, maybe its just not my day. :confused:
I've made some code but im not sure what return statement i should use.
Here is my code followed by the compiler error:
Code:
import java.util.Arrays.*;
import java.lang.*;
public class SnakeGame
{
char s = ' ';
//create main method(All Java prgrams need one to run ;))
public static void main(String[] args)
{
}
//Create a 2D grid for the game to be played on
public static class Grid
{
Grid[][] grid = new Grid[31][31]; // 31x31 grid
static void fill(char grid[][], char _){}
}
public static String deepToString (String grid[][])
{
System.out.println(grid);
}
}
Code:
SnakeGame.java:29: missing return statement
}
^
1 error
Look at your deepToString method...
Your deepToString method is not returning a string ... that's what the
Code:
public static [B][U]String[/U][/B] deepToString (String grid[][])
... means... that this method returns a string.
Luck,
CJSL
What does the deeepToString method do?
I'll try to answer your question about the return statement, but first I (we) need to know about the deepToString method:
- What is this method supposed to do? I sounds like it is to convert something (deep?) to a string.
CJSL