title: Creating a point object from a user input
body: <p>I am supposed to read an input of 4 coordinates
  Example: 0 1 1 1 (where 0 and 1 are the X and Y coordinates of the 1st point and 1 and 1 are the coordinates of the second point)
  How am I supposed to store these integers in an arraylist of type Point.
  Following is my approach :</p>
  
  <pre><code>  public class Project1 {
       private int m;
       private int n;
       private WeightedQuickUnionUF qu;
       private int[][] grid;
       private ArrayList&lt;Point&gt; connections;
  
      /**
      * initializes UnionFind structure, grid and connection list
      * @param m
      * @param n
      */
      public Project1(int m, int n){
      m=m;
      n=n;
      for (int i = 0; i &lt; m; i++) {
      for (int j = 0; j &lt; n; j++) {
       grid = new int[i][j];
      }
     }
   connections = new ArrayList&lt;Point&gt;();
   int size = m*n;
   qu = new WeightedQuickUnionUF(size);
  
     }
  
    public void read_input() 
    {
      Scanner sc = new Scanner(System.in);
      System.out.print("Enter number of pairs of connections:  ");
      int no_of_connections = sc.nextInt();
      for(int i=0; i &lt; (no_of_connections * 4); i++){
      Point coordinates = (Point)sc.nextInt();
      connections.add(coordinates);
    }
     sc.close();
   } 
  </code></pre>