I'm working on some homework, and I'm not asking for help on how to solve it. For some reason Eclipse underlines parts of my code indicating something is wrong; yet provides no suggestion like it normally would. I haven't declared a multi-dim array in some time, so the syntax eludes me though I did google it. It appears correct according to the results I got.
This is what I found on google:
Initialising a multidimensional array in Java
For this class we are using a method of feeling the walls around you to find a path to follow, and marking where we have been with X's in an ASCII maze. #'s are walls, '.''s are paths, and 'F' is the finish point.
EDIT: After getting an answer, I wanted to post what the syntax underlining looked like so here:
public class Maze {
static char[][] tmp = new char [12][12];
//First element is Y values (because X and Y lines are perpendicular)
//First ROW (top)
tmp [0][0] = '#';
tmp [1][0] = '#';
tmp [2][0] = '#';
tmp [3][0] = '#';
tmp [4][0] = '#';
tmp [5][0] = '#';
tmp [6][0] = '#';
tmp [7][0] = '#';
tmp [8][0] = '#';
tmp [9][0] = '#';
tmp [10][0] = '#';
tmp [11][0] = '#';
//Second Row
tmp [0][1] = '#';
tmp [1][1] = '.';
tmp [2][1] = '.';
tmp [3][1] = '.';
tmp [4][1] = '#';
tmp [5][1] = '.';
tmp [6][1] = '.';
tmp [7][1] = '.';
tmp [8][1] = '.';
tmp [9][1] = '.';
tmp [10][1] = '.';
tmp [11][1] = '#';
//Third row
tmp [0][2] = '#';
tmp [1][2] = '.';
tmp [2][2] = '.';
tmp [3][2] = '.';
tmp [4][2] = '#';
tmp [5][2] = '.';
tmp [6][2] = '.';
tmp [7][2] = '.';
tmp [8][2] = '.';
tmp [9][2] = '.';
tmp [10][2] = '.';
tmp [11][2] = '#';
//incomplete!
public static void main (String [] args) {
for(int i = 0; i != 12; i++) {
for(int j = 0; j != 12; j++) {
System.out.println(tmp[i][j]);
}
}
}
}
}
Keep in mind that I am just starting, and I'm unsure about what the array elements should contain where, so if the top actually goes down the left side, that is why. It won't even build now so I haven't been able to test it!
NOTE: I would post a picture of what Eclipse is showing underlined but I am unfamiliar with Stackoverflow's image linking/hosting. It looks like it take a link from another site; yet I really don't want to set up an account on a picture hosting site just for this and never use it again!
The portion which are underlined are:
Line 2 (where tmp is declared) at the very end, only beneath the semi-colon.
and
The line which declares the main method, specifically only beneath the
opening and closing parentheses.