My program complies but when I run the program it gives me an "Array Index Out of Bounds Exception"
public void readBoard(String filename) throws Exception {
File f = new File("myBoard.csv");
Scanner reader = new Scanner(f);
while(reader.hasNext()){
String line = reader.nextLine();
String [] b = line.split(",");
String type = b[0];
int i = Integer.parseInt(b[1]);
int j = Integer.parseInt(b[2]);
if(type.equals("Chute"))
board[i][j] = new Chute();
else if(type.equals("Ladder"))
board[i][j] = new Ladder();
}
the error is at int i = Integer.parseInt(b[1]); My question is the way I turned the String [1] and [2] into an int correct? I would think it's not since I have an array out of bounds exception. I'm guessing it means it point at the spot in the area and there's nothing.