好吧,我有一个名为 AbstractPlayer 的界面
package gr.auth.ee.dsproject.crush.player;
import gr.auth.ee.dsproject.crush.board.Board;
import java.util.ArrayList;
public interface AbstractPlayer
{
public void setId (int id);
public int getId ();
public void setName (String name);
public String getName ();
public void setScore (int score);
public int getScore ();
public int[] getNextMove (ArrayList<int[]> availableMoves, Board board);
}
以及我必须制作的名为 RandomPlayer 的课程
package gr.auth.ee.dsproject.crush.player;
public class RandomPlayer implements AbstractPlayer
{
int id;
String name;
int score;
public RandomPlayer () {
}
public RandomPlayer (Integer pid) {
id=pid;
}
public int getId (){
return id;
}
public String getName (){
return name;
}
public int getScore (){
return score;
}
public void setId(int idSet){
id=idSet;
}
public void setName(String nameSet){
name=nameSet;
}
public void setScore(int scoreSet){
score=scoreSet;
}
public int[] getNextMove (ArrayList<int[]> availableMoves, Board board) {
int k;
k=availableMoves.size();
int randMove;
randMove=(int)(Math.random()*k);
int[] arrayMyMove;
arrayMyMove= new int[3];
arrayMyMove=getRandomMove(availableMoves , randMove);
int[] arrayReturn;
arrayReturn = new int[4];
arrayReturn[0]=arrayMyMove[0];
arrayReturn[1]=arrayMyMove[1];
int movement=arrayMyMove[2];
if (movement==0) {
arrayReturn[2]=arrayReturn[0]-1;
} else if (movement==2) {
arrayReturn[2]=arrayReturn[0]+1;
} else if (movement==1) {
arrayReturn[3]=arrayReturn[1]-1;
} else if (movement==3) {
arrayReturn[3]=arrayReturn[1]+1;
}
return arrayReturn;
}
我得到这个错误
RandomPlayer 类型必须实现继承的抽象方法 AbstractPlayer.getNextMove(ArrayList, Board)
并且在我实现方法 getNextMove 的行上,我收到此错误 此行有多个标记 - ArrayList 无法解析为类型 - Board 无法解析为类型
有人可以告诉我我的错误是什么吗?