//MyPoint类:
package cc1;
public class MyPoint {
private int x;
private int y;
//构造方法
public MyPoint(){}
public MyPoint(int x,int y){
this.x = x;
this.y = y;
}
//get,set方法
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
}
//测试方法
package cc1;
public class TestMyPoint {
public static void main(String[] args) {
MyPoint mp = new MyPoint();
mp.setX(34);//改成你学号的前两位
mp.setY(25);//改成学号后两位
System.out.println("x:"+mp.getX()+" y:"+mp.getY());
}
}
//测试结果: