📄 chessman.java
字号:
package finalexam;
public abstract class Chessman implements IChessman{
int color = 0;
int posX=1,posY=1;
public Chessman(int x,int y,int c){
posX =x ;
posY =y ;
color = c;
}
public int getColor(){return color;}
abstract public String getId();
abstract public String toString();
public final void move(int x,int y) throws IllegalMoveException{
moveTo(posX+x,posY+y);
}
public void moveTo(int x,int y) throws IllegalMoveException{
if (x<0 || x >9 || y<0 || y>10){
throw new IllegalMoveException("出界");
}
posX=x;
posY=y;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -