NTU-OOP-Tuts-2025-1/T3Q2-3/src/Point.java

14 lines
411 B
Java

public class Point {
protected int x, y;
public Point() { x = 0; y = 0; }
public Point(int x, int y) { this.x = x; this.y = y; }
public void setPoint(int x, int y) { this.x = x; this.y = y; }
public int getX() { return x; }
public int getY() { return y; }
public String toString() { return String.format("[%d,%d]", x, y); }
public String printPoint() { return toString(); }
}