location.java

来自「西电科大的基于java面向对象教程」· Java 代码 · 共 41 行

JAVA
41
字号
public class Location{
	private int x;
	private int y;

	public Location(int newX,int newY){
		setX(newX);
		setY(newY)
	}

	public Location(){
	}

	public int getX(){
		return x;
	}

	public int getY(){
		return y;
	}

	public boolean equal(Point other){
		return other.x==this.x&&
				other.y==this.y;
	}

	public void xMove(int amount){

	}

	public void yMove(int amount){
		y+=amount;
	}

	private void setX(int x){
		this.x=x;
	}

	private void setY(int y){
		this.y=y;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?