我不知道这意味着什么。 Eclipse不应该像这样给出答案。这是我的代码。请帮帮我。
import java.util.ArrayList;
import java.util.List;
/**
* An immutable class to represent a snapshot of the state of a table.
*
*/
public class DetailedHoldemTable extends Table {
private static final long serialVersionUID = 1647960710321459407L; //Here is the error
(name = "player");
private final List<SeatedPlayer> players;
private final boolean playing;
private final TableConfiguration property;
private final Pots pots;
private final SeatedPlayer dealer;
private final List<Card> communityCards;
private final Round round;
public DetailedHoldemTable(TableId id, String name, List<SeatedPlayer> players,
boolean playing, TableConfiguration property, Pots pots, SeatedPlayer dealer, List<Card> communityCards, Round round) {
super(id,name);
this.players = players==null? new ArrayList<SeatedPlayer>():new ArrayList<SeatedPlayer>(players);
this.playing = playing;
this.property = property;
this.pots = pots;
this.dealer = dealer;
this.communityCards = communityCards==null? new ArrayList<Card>():new ArrayList<Card>(communityCards);
this.round = round;
}
public DetailedHoldemTable(TableId id, String name, List<SeatedPlayer> players,
boolean playing, TableConfiguration property) {
this(id,name, players, playing, property, null, null, null, null);
}
protected DetailedHoldemTable() {
this.players = null;
this.playing = false;
this.property = null;
this.pots = null;
this.dealer = null;
this.communityCards = null;
this.round = null;
}
/**
* Returns the list of players at this table.
*
* @return The list of players at this table.
*/
public List<SeatedPlayer> getPlayers() {
return players;
}
/**
* The number of players seated at this table.
*
* @return The number of players seated at this table.
*/
public int getNbPlayers() {
return players.size();
}
/**
* The playing status of this table.
*
* @return True if the players are playing, false otherwise.
*/
public boolean isPlaying() {
return playing;
}
/**
* Returns the game property of this table.
*
* @return The game property of this table.
*/
public TableConfiguration getTableConfiguration() {
return property;
}
public Pots getPots(){
return pots;
}
public SeatedPlayer getDealer(){
return dealer;
}
public List<Card> getCommunityCards(){
return communityCards;
}
public Round getRound() {
return round;
}
}
错误发生在第5行,我在其中定义了serialVersionUID。正如我在标题中所写,eclipse要求符号&lt;在逗号之后,但在我看来这没有任何意义。它给我的信息与标题中的信息相同
答案 0 :(得分:2)
Eclipse只是指向 (name =&#34; player&#34;);
您需要将名称定义为
private final String name = "player";
并且应该解决您的错误
答案 1 :(得分:0)
Eclipse并不喜欢您指向的行下方的代码:
(name = "player");
我猜测,通过使用name的值调用超类Table,你想要替换
super(id,name);
使用:
super(id,"player");