import java.util.Arrays;
/**
*
*/
/**
* @author abogal6274
*
*/
public class TicTacToe {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
TTTBoard();
}
public static void TTTBoard(){
String[][] tttBoard = new String[3][3];
for(int i=0; i<=3;i++){
tttBoard[i][3] = "[ ]";
}
System.out.println(Arrays.deepToString(tttBoard));
}
}
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3
at TicTacToe.TTTBoard(TicTacToe.java:25)
at TicTacToe.main(TicTacToe.java:18)
The thing about this is that it says this as an error. Why? I tried like making it i<=3
, i<4
and all stuff but I still get error. I really need help on this to finish my tic tac toe App.
EDIT: Thats solved but:
it prints out this: [[null, null, [ ]], [null, null, [ ]], [null, null, [ ]]]
whitch its suppose to print but can it be vertical like a tic tac toe board?