title: Using a delimiter in scanner; ignoring spaces & new lines
body: <p>Good day,</p>
  
  <p>I am trying to read a txt file using scanner, and save the characters into a 2D String array. The txt file consists of 8 lines of characters, not separated by spaces. My program works (if you remove the delimiter) if they are separated by spaces, or (including the delimiter) without spaces if the characters are all in one line. </p>
  
  <p>If someone could show me how to save the characters correctly that would be greatly appreciated. The problem is in the Read() function, with the double for-loop. I tried adding another delimiter (s.useDelimiter(s.nextLine())) but I do not know how to implement it.</p>
  
  <p>Keep in mind this is my first time using a scanner for a file and I'm only learning programming, thus my code won't be very advanced.</p>
  
  <p>Kind regards,
  Matthew</p>
  
  <pre><code>import java.util.Scanner;
  import java.io.File;
  import java.io.FileNotFoundException;
  
  public class BoardFile {
  
      String[][] board = new String[8][8];
      Scanner s;
  
      // Print the board
      public void Printboard() {
          for (int i = 0; i &lt; 8; i++) {
              for (int j = 0; j &lt; 8; j++) {
                  System.out.print(board[i][j]);
              }
              System.out.println();
          }
      }
  
      public void Open() {
          try {
              s = new Scanner(new File("**TXT FILE PATHNAME HERE**"));
          } catch (FileNotFoundException e) {
              System.out.println("Error");
          }
      }
  
      public void Read() {
          s.useDelimiter("");
          for (int i = 0; i &lt; 8; i++) {
              for (int j = 0; j &lt; 8; j++) {
                  String a = s.next();
                  board[i][j] = a;
              }
          }   
      }
  
      public static void main(String[] args) {
          BoardFile a = new BoardFile();
          a.Open();
          a.Read();
          a.Printboard();
      }
  }
  </code></pre>
  
  <p>The txt file:
  <a href="https://www.dropbox.com/s/k8fkneg2dcw0cbe/abcde.txt?dl=0" rel="nofollow noreferrer">https://www.dropbox.com/s/k8fkneg2dcw0cbe/abcde.txt?dl=0</a></p>