title: JAVA - How to create an array of objects?
body: <p>I need to read a CSV file into an array of Objects.
  I didn't realise that it had to go into one, and just made an ArrayList instead. I now need to fix that, and have no idea what I'm doing.</p>
  
  <p>This is my code to read the CSV file into a multidimensional array.</p>
  
  <pre><code>public static void readClub() throws IOException {
          BufferedReader clubBR = new BufferedReader(new FileReader(new File("nrlclubs.txt")));
          String line = "";
  
          ArrayList&lt;String[]&gt; clubsArr = new ArrayList&lt;String[]&gt;(); 
  
          while ((line = clubBR.readLine()) != null) { 
  
              String[] club = new String[3]; 
  
              for (int i = 0; i &lt; 3; i++) { 
                  String[] value = line.split(",", 3);
                  club[i] = value[i]; 
              }
  
              clubsArr.add(club); 
          }
  </code></pre>
  
  <p>A snippet of my CSV file is this:</p>
  
  <pre><code>Glebe,G Shield,Glebe District
  Cumberland,C Shield,Central Cumberland
  Annandale,A Shield,Annandale District
  University,Lion,Sydney Uni Rugby League Club
  Souths,Rabbit,South Sydney,Rabbitohs
  Easts,Rooster,Eastern Suburbs,Roosters,Sydney Roosters
  Balmain,Tiger,Tigers,Balmain Tigers
  Newtown,Jets,Jets,Newtown Jets,Bluebags
  </code></pre>
  
  <p>The first word is the Team name, the second word is the Team mascot, and the rest are the alias's.</p>
  
  <p>Now the question is, how do i do the same thing, but with an Array of Objects (in a class called Clubs)?
  I just spent a few hours trying to get this working, only to be told its wrong, and the Array of Objects is doing my head in :'(</p>
  
  <p>Thanks heaps!</p>
  
  <p><strong>edit:
  ok, the actual question is this:</strong>
  the program should read the content of the data file (NRLclubs.txt) into memory into an appropriate array of objects (see previous page for descriptions of the class). Do not assume that the file exists.</p>
  
  <p><strong>The description of the class is this:</strong>
  Club class: the Club class represents an individual NRL club within the competition. The Club class needs to store data for the current club name, current club mascot, any aliases by which the club is or has been known. As well as the normal methods that should be created for a class (eg, constructors, ‘setters’, and ‘getters’) you will need to decide upon appropriate methods for this class based upon the general requirements of the assignment specification.</p>