title: How to print the actual strings in an arraylist?
body: <p>I am trying to print the contents of an arraylist that I am using to store arrays of strings. Basically, I am trying to write a program that reads a file line by line, and stores the individual lines as separate arrays of strings in an arraylist. I want to check if it worked by printing the string arrays in the arraylist but currently my code is only printing the addresses. It looks like the following:</p>
  
  <pre><code>package Filecheck;
  import java.io.*;
  import java.util.ArrayList;
  import java.util.Iterator;
  
  public class FileImport {
      public static void main(String [] args) {
  
          // The name of the file to open.
          String fileName = "/Users/Frank/Desktop/test.rtf";
  
          String line;
          String[] name = null;
          ArrayList&lt;String[]&gt; list = new ArrayList&lt;String[]&gt;();
          try {
  
              FileReader fileReader = new FileReader(fileName);
  
              BufferedReader readerB = new BufferedReader(fileReader);
              line = readerB.readLine();
              while((line = readerB.readLine()) != null) {
                  System.out.println(line);
                  name = line.split(" ");
                  list.add(name);
              }
              for (int i=0; i &lt; list.size(); i++){
                  System.out.println(list.get(0).toString());
              }
  
              readerB.close();         
          }
          catch(FileNotFoundException ex) {
              System.out.println(
                  "Unable to open file '" + 
                  fileName + "'");                
          }
          catch(IOException ex) {
              System.out.println(
                  "Error reading file '" 
                  + fileName + "'");                  
  
          }
      }
  }
  </code></pre>
  
  <p>The output of the code is as follows:</p>
  
  <pre><code>{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
  {\colortbl;\red255\green255\blue255;}
  \margl1440\margr1440\vieww10800\viewh8400\viewkind0
  \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
  
  \f0\fs24 \cf0 \
  Test String The pens are going to win the cup\
  Another Test}
  [Ljava.lang.String;@533ded59
  [Ljava.lang.String;@533ded59
  [Ljava.lang.String;@533ded59
  [Ljava.lang.String;@533ded59
  [Ljava.lang.String;@533ded59
  [Ljava.lang.String;@533ded59
  [Ljava.lang.String;@533ded59
  [Ljava.lang.String;@533ded59
  </code></pre>
  
  <p>Any help would be greatly appreciated. Thank you!</p>