编写javadocs的正确方法
我已经得到了一个很好的工作,在一些代码中添加一些javadoc。 这是我的问题: 为这个构造函数编写javadoc的正确方法是什么编写javadocs的正确方法,java,constructor,javadoc,Java,Constructor,Javadoc,我已经得到了一个很好的工作,在一些代码中添加一些javadoc。 这是我的问题: 为这个构造函数编写javadoc的正确方法是什么 public Match(int MatchID, int MatchRound, int HomeTeamID, int GuestTeamID, boolean IsPlayed) { this.isPlayed = IsPlayed; this.matchID = MatchID; this.matchRound = MatchRoun
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;
}
以下是格式化的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模板。我不会写任何东西,因为这很明显
不过,我会按照Java惯例重命名所有参数。您没有一个IDE为您完成这项工作吗?了解javadoc工具是值得的。您是否对现有文档有特定的问题,或者您只是想学习如何编写文档?您还应该以小写字母开始命名参数变量,因为这是Java约定。这些参数已经可以通过“this”来消除歧义了。这种侧重点忽略了问题,但这也是我的观点。看看另一个答案中的Javadoc是什么样子,看看它有多么荒谬的无用。这是一个我一直在和一个小组合作的项目,我们的老师说我们已经为所有事情编写了Javadoc。。即使是那些令人讨厌的人这是个坏兆头。在任何情况下,通过正确的命名,Java文档工具将生成基本相同的文档。