title: How do I read each column of a txt file, and place them in separate arrays?
body: <p>I'm doing a Programming Assignment and basically I need to read from a txt file and sort everything in there in different arrays allowing me to display everything in the cmd prompt neatly and be able to delete stuff.</p>
  
  <pre><code>h Vito 123
  d Michael 234 Heart
  s Vincent 345 Brain Y
  n Sonny 456 6
  a Luca 567 Business
  r Tom 678 Talking Y
  j Anthony 789 Maintenance N
  d Nicos 891 Bone
  n Vicky 911 7
  </code></pre>
  
  <p>First column needs to be the employeeRole (employee, doctor). The second column being the employeeName. Third column being the employeeNumber and some of them have have a fourth column (if it's a number it's number of patients. Y is for like sweeping, or answering calls)</p>
  
  <p>So my thought process was put each column into it's own array and then writing it out that way. I was able to put each row into its own array with</p>
  
  <pre><code>public class ReadingFile {
   // String test;
    // char[] employeeRole = new char[9];
     String[] employeeRole = new String[9];
     String[] employeeName = new String[9], specialty;
     String[] wholeLine = new String[9];
    // String word;
  
     int[] employeeNum = new int[9];
     int r, n, l, num;
     public void Reader()
      {
      Scanner inputStream = null;
      Scanner inputStream2 = null;
      Scanner inputStream4 = null;
      try
      {
          BufferedReader inputStream3 =
                      new BufferedReader(new FileReader("data.txt"));
          inputStream = new Scanner(new FileInputStream("data.txt"));
          inputStream =
                      new Scanner(new FileInputStream("data.txt"));
          inputStream2 =
                      new Scanner(new FileInputStream("data.txt"));
                      inputStream4 =
                      new Scanner(new FileInputStream("data.txt"));
                      System.out.println("Yeah");
  
      }
      catch(FileNotFoundException e){
          System.out.println("File Not found");
          System.exit(1);
      }
  for (l=0; l&lt;9; l++)
  {
      wholeLine[l] = inputStream2.nextLine();
  
      System.out.println(wholeLine[l]);
  }
  </code></pre>
  
  <p>But I couldn't figure out what to do from there. Doing a split would then put an array into an array? Which means I would put each line into an array and then each word into an array?</p>
  
  <p>So I tried something else, anything with the length not equal to 1 would be the employeeNum, but then they there were the N's and Y's and the number of pateints.</p>
  
  <pre><code>    for(r=0; r&lt;9; r++) //role
      {
         String next = inputStream4.next();
         while( next.length() != 1)
         {
             next = inputStream4.next();
         }
  
          employeeRole[r] = next;
  
         System.out.println(employeeRole[r]);
      }
  </code></pre>
  
  <p>I also tried </p>
  
  <pre><code>for (r=0; r&lt;9; r++)
  {
      employeeRole[r] = wholeLine[r].substring(wholeLine[r].indexOf(1));
      //inputStream.nextLine();
      System.out.println(employeeRole[r]);
  }
  </code></pre>
  
  <p>I'm just not sure if I'm going the right way about it? If I'm making it more difficult than it really is? Or if there's an easier way to do this. But after everything is done, the output should be able to basically say</p>
  
  <pre><code>Doctors: 2
  Name: Michael  Employee Number: 234 Specialty: Heart
  Name: Nicos     Employee Number: 891 Specialty: Bone
  </code></pre>
  
  <p>Any help would be greatly appreciated, thanks!</p>