title: Array List replace all elements with last one
body: <p>I have these three classes in java and am having a problem with array list. Why does array list replace all elements with last entry?</p>
  
  <p>arraylist.java</p>
  
  <pre><code>import java.util.ArrayList;
  
  public class arraylist {
      public ArrayList&lt;Circle&gt; circles = new ArrayList&lt;Circle&gt;();
  }
  </code></pre>
  
  <p>circle.java</p>
  
  <pre><code>public class Circle {
      public int x;
      public int y;
  }
  </code></pre>
  
  <p>run.java</p>
  
  <pre><code>public class run {
  
      public static void main(String[] args) {
          arraylist ar=new arraylist();
          Circle c = new Circle();
          Scanner s = new Scanner(System.in);
          for (int i = 0; i &lt;= 2; i++)
          {
              c.x = s.nextInt();
              c.y = s.nextInt();
              boolean status = ar.circles.add(c);
              if (status)
                  System.out.print("added to circles ...");
          }
          System.out.print("########################################");
          for (Circle c2:ar.circles)
          {
              System.out.print("\nx=" + c2.x + "   y=" + c2.y);
          }
      }
  }
  </code></pre>