title: Function to read an array list from file and display on the screen
body: <p>I'm trying to write a method to read an array list from a file and then display it on the screen but it doesn't work at the end. Here is the method I'm using:</p>
  <p>Description:</p>
  <ul>
  <li>Point class contains constructor, getter, setter, toString()</li>
  <li>PrintPoint class contains constructor, print method, and read from file method</li>
  <li>TestPoint class to test</li>
  </ul>
  <p>Point class</p>
  <pre><code>public class Point {
      
      private double x;
      private double y;
      private String name;
      
      public Point(String name, double x, double y){
          this.name = name;
          this.x = x;
          this.y = y;
      }
      
      //setter and getter
      
      @Override
      public String toString(){
          return this.name + &quot;[&quot; + this.x + &quot;, &quot; + this.y + &quot;]&quot;;
      }
  }
  </code></pre>
  <p>PrintPoint class</p>
  <pre><code>import java.util.*;
  import java.io.*;
  public class PrintPoint {
      
      private ArrayList&lt;Point&gt; pointList;
      
      //Constructor
      public PrintPoint(String path) throws FileNotFoundException{
        pointList = getPointFromFile(path);
      }
      
      //Print method
      public void printPointList(){
        for(Point p : pointList){
          System.out.println(p);
        }
      }
  
      //Read from file method
      public ArrayList&lt;Point&gt; getPointFromFile(String path) throws FileNotFoundException{
          try {
              Scanner myReader = new Scanner(new File(path));
              ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;();
              while (myReader.hasNextLine()) {
                  list.add(myReader.nextLine());
              }
              myReader.close();
          } catch (FileNotFoundException e) {
              System.out.println(&quot;An error occurred.&quot;);
              e.printStackTrace();
          }
          return new ArrayList&lt;Point&gt;();
      }
  }
  </code></pre>
  <p>TestPoint class:</p>
  <pre><code>import java.util.*;
  import java.io.*;
  public class TestPoint {
      public static void main(String[] args) throws FileNotFoundException{
          PrintPoint a = new PrintPoint(&quot;arraylist.txt&quot;);
          a.printPointList();
      }
  }
  </code></pre>
  <p>arraylist.txt</p>
  <pre><code>A,3,4
  B,5,6
  C,7,8
  </code></pre>
  <p>I want to print the array list but it doesn't work (no error just not print).</p>
  <p>UPDATED: I have updated the question with another requirement.</p>