编写javadocs的正确方法

时间:2015-01-14 15:22:55

标签: java constructor javadoc

我已经获得了一些exiciting工作,可以在某些代码中添加一些javadoc。 所以这是我的问:

为这个构造函数编写javadoc的正确方法是什么。

public Match(int MatchID, int MatchRound, int HomeTeamID, int GuestTeamID, boolean IsPlayed) {
    this.isPlayed = IsPlayed;
    this.matchID = MatchID;
    this.matchRound = MatchRound;
    this.homeTeamID = HomeTeamID;
    this.guestTeamID = GuestTeamID;
}

2 个答案:

答案 0 :(得分:3)

我不会写任何,因为它很明显。

重命名所有参数以遵循Java约定。

答案 1 :(得分:1)

这是格式化的Javadoc:

/**
 * Constructor for creating a new match.
 * @param MatchID the id of the match
 * @param MatchRound the round for the match
 * @param HomeTeamID the id of the home team
 * @param GuestTeamID the id of the guest team
 * @param IsPlayed whether or not the match is played
 */
public Match(int MatchID, int MatchRound, int HomeTeamID, int GuestTeamID, boolean IsPlayed) {

在Eclipse中,您只需在构造函数上方键入/**,它就会自动生成Javadoc模板。

相关问题