All pastes #439365 Raw Edit

Someone

public text v1 · immutable
·published 2007-04-14 06:04 UTC
rendered paste body
I'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[4][4];  //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++) {
          String[] lol = input.next().toCharArray();
          for(int k=0;k<=lol.length;k++) {
             array[i][j]=lol[k];
          }
       }
     }
   }

} catch (IOException ioe) {
  System.exit(1);
}