package collection;
import java.util.ArrayList;
import java.util.Collection;
public class ContainsDemo {
public static void main(String[] args){
Collection c = new ArrayList();
c.add(new Point(1,2));
c.add(new Point(2,5));
c.add(new Point(6,1));
c.add(new Point(5,2));
c.add(new Point(3,2));
System.out.println(c);
}
}
package collection;
public class Point {
private int x;
private int y;
public Point(int x, int y) {
super();
this.x = x;
this.y = y;
}
public String toString(){
return "("+x+","+y+")";
}
}
|