如何在 java 文档中显示构造函数注释?

我有一个类,其中包含一个带有获取器和 setter 的构造函数,并且需要为它们创建一个 javadoc。


当我制作javadoc时,获取者和设置者都有他们的评论,但由于某种原因,构造函数没有出现在javadoc中。注意:我正在CMD中创建爪哇文档。我尝试过更改HTML版本,但仍然一无所获


这是类的样子:


/**

 * PersonalDetails class

 *

 * <p>Details the general information of a person involved in Saint Louis 

 University

 */


public class PersonalDetails {

    private String name;


/**

 * Creates a person with the specified characteristics

 * @param name a String containing the name of the person

 * @param sy   a String specifying the current school year

 * @param idNo a String containing the id number of the person

 */

PersonalDetails(String name, String sy, String idNo){

    this.name = name;

    this.sy = sy;

    this.idNo = idNo;

}


/**

 * Registers the name of the person

 * @param name a String containing the name of the person

 */

public void setName(String name) {

    this.name = name;

}


/**

 * Retrieves the name of the person

 * @return a String representing the name of the person

 */

public String getName() {

    return name;

 }


}

我需要有块注释,以便构造函数个人详细信息显示在javadoc中。


蝴蝶刀刀
浏览 172回答 2
2回答

缥缈止盈

使用&nbsp;-包标志调用 javadoc,以便它包含包私有 API 成员。-package仅显示包、受保护和公共类和成员。

手掌心

将其设为公共public&nbsp;PersonalDetails(String&nbsp;name,&nbsp;String&nbsp;sy,&nbsp;String&nbsp;idNo){或配置 Javadoc,它也记录了您的包可见构造函数。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java