给定下面的类定义。如何决定存根方法应该是静态的还是非静态的?
class Point {
private final int x;
private final int y;
public Point(int x, int y) {
this.x = x;
this.y = y;
}
// Should the methods add(), subtract() and inverseOf() be non-static ...
public Point add(Point point) {
}
public Point subtract(Point point) {
}
public Point inverseOf() {
}
// Or static?
public static Point add(Point point1, Point point2) {
}
public static Point subtract(Point point1, Point point2) {
}
public static Point inverseOf(Point point) {
}
}