示例:
/**
* Title: Person类<br/>
* Description:通过Person类说明Java中的文档注释<br/>
* Company: ***
* @author ***
* @version 1.0
*/
public class Person {
/**
* 这个是Person类的构造方法
* @param name Person 的名字
* */
public Person(String name) { //执行语句; } /** * 这是read()方法说明 * @param bookName 读的书的名字 * @param time 读书所用的时间 * @return 读的书的数量 * */ public int read(String bookName, int time) { //执行语句; return 1; } }
生成命令
person Mac$ javadoc -d . -version -author Person.java
注意Person.java路径名要正确。
效果:
其中index.html为主页,打开如下图: