title: Array out of bounds with string split
body: <p>I'm reading from a text file, and setting parameters for my object (Dogs) to the information on the text file. It's a very simple task but I keep getting an array out of bounds error every time I try to access field[1] or field[2]. My code is as follows:</p>
  
  <pre><code>BufferedReader inFile = new BufferedReader(new FileReader("dogslist.txt"));
      String line  = inFile.readLine();
      int count = 0;
      Dogs[] parlour = new Dogs[16];
  
      while(line != null)
      {
      String[] field = line.split("#");
      int age = Integer.parseInt(field[2]);
      parlour[count] = new Dogs(field[0],field[1],age);
      System.out.println(parlour[count]);
      count++;
      line = inFile.readLine();
      }
  </code></pre>
  
  <p>Here are the contents of the text file:</p>
  
  <pre><code>Jerry#German Sheapord#4
  Owen#cat#3
  Morgan#MathsGenius#7
  </code></pre>
  
  <p>Text file of Error, textfile and code: <a href="http://pastebin.com/SznqE45i" rel="nofollow">http://pastebin.com/SznqE45i</a></p>