title: NullPointerException while reading file into array
body: <p>I've been getting null pointer exception while reading a file into an array. i realized that the exception appears when it is null and something else is required. The array minefield has already been initialized. The exception happens on " minefield[i][j]=input.charAt(j)+"";"</p>
  
  <p>I'm trying to read in a file with this format:</p>
  
  <pre><code>#of row
  #of column
  abcd
  efgh
  ijkl
  </code></pre>
  
  <p>This is the code:</p>
  
  <pre><code>     try {
              BufferedReader in =new BufferedReader (new FileReader(name+".txt"));
              String input=in.readLine();      
              row = Integer.parseInt(input);
              input=in.readLine();
              col = Integer.parseInt(input);
              int c =0;
              input=in.readLine();
              for (int i=0;i&lt;row;i++){
              input=in.readLine();
              for (int j=0;j&lt;col;j++){
                    System.out.println (input.charAt(j));
                    minefield[i][j]=input.charAt(j)+"";
                 }
              }
              System.out.println("The file has been loaded");
              in.close();
           }
              catch(IOException iox){
                 System.out.println ("Error reading file");
              }
  </code></pre>
  
  <p>Your help is greatly appreciated. 
  Edit: Sorry i left something out. </p>