title: Trying to display contents of ArrayList. Getting [Ljava.lang.String;@232204a1
body: <p>I am attempting to output the contents of an ArrayList, but no matter which approach I try I seem get the location of the Array rather than the contents of the Array. Running each of the following together gives me:</p>
  
  <pre><code> run:
   [[Ljava.lang.String;@55f96302, [Ljava.lang.String;@232204a1, [Ljava.lang.String;@4554617c, [Ljava.lang.String;@7f31245a, [Ljava.lang.String;@2503dbd3, [Ljava.lang.String;@5cad8086]
  
  
   [Ljava.lang.String;@232204a1
   [Ljava.lang.String;@232204a1
   [Ljava.lang.String;@232204a1
  </code></pre>
  
  <p>Here's the code snippet:</p>
  
  <pre><code>// Each of the following approaches results in 
  // [Ljava.lang.String;@232204a1 
  // instead of the actual value of the ArrayList.
  
  String test = accountNumbers.get(1);
  System.out.println(test);
  
  System.out.println(accountNumbers.get(1));
  
  System.out.println(accountNumbers.get(1).toString());
  
  // This actually outputs:
  // [[Ljava.lang.String;@55f96302, [Ljava.lang.String;@232204a1, [Ljava.lang.String;@4554617c, [Ljava.lang.String;@7f31245a, [Ljava.lang.String;@2503dbd3, [Ljava.lang.String;@5cad8086] 
  String str = Arrays.toString(accountNumbers.toArray()); 
  System.out.println(str);
  </code></pre>
  
  <p>I'm not really sure what's causing this. Is there some way to get the contents to display? </p>
  
  <p><strong>EDIT:</strong> Here's the entire method. An answer on another question (<a href="https://stackoverflow.com/questions/32856875/arrays-are-null-not-getting-information-from-while-loop">here</a>) advised me to try using ArrayList instead of the approach I was using. I adapted the suggestion, but I felt that the problems were better placed in a new question rather than as an edit to that question.</p>
  
  <pre><code>protected static void loadAccountInformationFromFile() throws Exception 
  {
  
      Scanner account = new Scanner(new File(INPUT_ACCOUNT_FILE)).useDelimiter(",");
  
          int sortCount = 1;
  
          List&lt;String&gt; accountNumbers = new ArrayList&lt;&gt;();
          List&lt;String&gt; firstNames = new ArrayList&lt;&gt;();
          List&lt;String&gt; lastNames = new ArrayList&lt;&gt;();
          List&lt;String&gt; balances = new ArrayList&lt;&gt;();
          List&lt;String&gt; lastVariables = new ArrayList&lt;&gt;();
  
  
      do {
  
          String[] temp1 = account.next().split(",");
          String temp2 = "" + temp1;
  
          if (sortCount == ACCOUNT_NUMBER_COUNT) {
              accountNumbers.add(temp2);
          } else if (sortCount == FIRST_NAME_COUNT) {
              firstNames.add(temp2);
          } else if (sortCount == LAST_NAME_COUNT) {
              lastNames.add(temp2);
          } else if (sortCount == BALANCE_COUNT) {
              balances.add(temp2);
          } else if (sortCount == LAST_VARIABLE_COUNT) {
              lastVariables.add(temp2);
          }
  
          if (sortCount &lt; MAX_VALUES_PER_LINE) {
              sortCount++;
          } else {
              sortCount = 1;
          }
      } while (account.hasNext());
  
  
      // Each of the following approaches results in 
      // [Ljava.lang.String;@232204a1 
      // instead of the actual value of the ArrayList.
  
      String test = accountNumbers.get(1);
      System.out.println(test);
  
      System.out.println(accountNumbers.get(1));
  
      System.out.println(accountNumbers.get(1).toString());
  
      // This actually outputs:
      // [[Ljava.lang.String;@55f96302, [Ljava.lang.String;@232204a1, [Ljava.lang.String;@4554617c, [Ljava.lang.String;@7f31245a, [Ljava.lang.String;@2503dbd3, [Ljava.lang.String;@5cad8086] 
      String str = Arrays.toString(accountNumbers.toArray()); 
      System.out.println(str);
  
      account.close();
  
      // I want to adapt what I previously used to access the ArrayLists.
  
   //        Bank bank = new Bank();
   //            
   //        bank.openAccount(new CheckingAccount(10100, new      Customer("Adam", "Apple"),500.00,false));
   //        bank.openAccount(new CheckingAccount(10101, new Customer("Beatrice", "Bagel"),2000.00,true));
   //        bank.openAccount(new SavingsAccount(2010, new Customer("Adam", "Apple"),5000.00,0.02));
  }
  </code></pre>
  
  <p><strong>EDIT 2:</strong> Here are the class variables:</p>
  
  <pre><code>private final static String INPUT_ACCOUNT_FILE = "accountInfo.txt";
  private static final int ACCOUNT_NUMBER_COUNT = 0;
  private static final int FIRST_NAME_COUNT = 1;
  private static final int LAST_NAME_COUNT = 2;
  private static final int BALANCE_COUNT = 3;
  private static final int LAST_VARIABLE_COUNT = 4; 
  private final static int MAX_VALUES_PER_LINE = 5;
  </code></pre>
  
  <p><strong>EDIT 3:</strong> For the benefit of those who may read this question late and be confused by some of the comments on the correct answer, part of my issue was related to an issue with the text file itself. This is an example of the formatting of the text file:</p>
  
  <pre><code> 10100,First,Last,Balance,value
   10101,First,Last,Balance,value
   20100,First,Last,Balance,value
  </code></pre>
  
  <p>Also: To get the ArrayLists to store the correct strings I had to change sortCount from:</p>
  
  <pre><code>int sortCount = 1;
  </code></pre>
  
  <p>to</p>
  
  <pre><code>int sortCount = 0;
  </code></pre>
  
  <p>Because when it was set at 1 it would store the first name in the account number string.</p>