创建一个Point类,有成员变量x,y,方法getX(),setX(),还有一个构造方
法初始化x和y。创建类主类A来测试它。
public class Point { int x; public int getX() { return x; } public void setX(int x) { this.x = x; } int y; Point(int x,int y) { this.x=x; this.y=y; } public static void main(String[] args) { Point p=new Point(3,5); System.out.println(p.getX()); p.setX(4); System.out.println(p.getX()); } }