import java.util.*; //must do this to tell compiler where ArrayList is implemented

class TestPointList{
    public static void main(String [] args){
        
        List p = new ArrayList();
        p.add(new Point(1.0,5.0));
        p.add("String"); //legal 
        
        //Print the size of the list
        System.out.println("List size =" + p.size());
        
        //get() return Object, must type case to appropriate type to access methods
        System.out.println("First added Point's x coordinate:" + ((Point)p.get(0)).getX()); 
        
        //Will cause runtime problem
        //System.out.println(((Point)p.get(1)).getX()); 
        
        //************Parametrized List**********************                     
       /* List<Point> myp = new ArrayList<Point>();
        myp.add(new Point(4.0,5.0));
        System.out.println((myp.get(0)).getX());
        myp.add(new Point(3.0,5.0));
        System.out.println((myp.get(1)).getX());
        myp.add("string"); //compiler will catch the error
        */
    }
}

