public class Point
{
public static void main(String[] args)
{
Point p1=new Point();
Point p2=new Point(1,2);
p1.show();
p1.move(3,4);
p1.show();
p2.show();
p2.move(5,6);
p2.show();
}
Point()
{
this(0,0);
}
Point(float x,float y)
{
this.x=x;
this.y=y;
}
void move(float x,float y)
{
this.x=x;
this.y=y;
}
void show()
{
System.out.printf("(%f,%f)",x,y);
System.out.println();
}
private float x,y;
}
版权声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。