All pastes #439374 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-04-14 06:17 UTC
rendered paste body
I'm trying to store these chars from a file into a 2d array called array

ABCD
HBDA
WDFJ
SDFD

import java.util.*;
import java.io.*;

class test {
   public static void main(String[] args) {

      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.hasNext()) {
            for(int i=0; i<=3; i++) {
	           for(int j=0; j<=3; j++) {
		             char[] lol = input.next().toCharArray();
			                  array[i]=lol;
                  }
	    }
	
	}									     
    } catch (IOException ioe) {
         System.exit(1);
     }


 }
}