日期:2014-05-20 浏览次数:20905 次
//Point.java public class Point { int x, y; public Point(int x, int y) { this.x = x; this.y = y; } } //Line.java public class Line extends Point { int x1, y1, w; public Line(int startX, int startY, int endX, int endY, int width) { super(startX, startY); x1 = endX; y1 = endY; w = width; } public void move(int newStartX, int newStartY, int newEndX, int newEndY) { x = newStartX; y = newStartY; x1 = newEndX; y1 = newEndY; } public void print() { System.out.println("Line: x=" + x + "; y=" + y + "; x1="+ x1 +"; y1=" + y1 + "; w=" + w); } }