-
public class Point {
int x;
int y;
public Point() {
x = 0;
y = 0;
}
public Point ( int x, int y ) {
this.x = x;
this.y = y;
}
public String toString() {
return x + " " + y;
}
public static void main( String[] args ) {
Point pt = new Point();
Point pt2 = new Point( 10, 20 );
System.out.println( pt.toString() );
System.out.println( pt2.toString() );
}
}
|
|