Anonymous
public text v1 · immutableI'm trying to store these chars from a file into a 2d array called array
ABCD
HBDA
WDFJ
SDFD
Scanner input = null;
File file = new File(args[0]);
char[][] array = new char[3][3]; //put all the chars into this array
try {
input = new Scanner(file);
while(input.hasNextLine) {
for(int i=0 i<=3; i++) {
for(int j=0; j<=3; j++) {
array[i][j]=input.next().charAt(j);
}
}
}
} catch (IOException ioe) {
System.exit(1);
}