Javadoc

Posted 神之一招

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Javadoc相关的知识,希望对你有一定的参考价值。

/**
 * The student class is basic class.
 * @author Leon
 *
 */
public class Student {

/**
 * @param name The student‘s name
 * @param id student‘s id
 */
    public Student(String name, int id) {
        studentName = name;
        studentId = id;
    }

/**
 * Gets name of student
 * @return the name of student
 */
    public String getName() {
        return studentName;
    }
    
/**
 * Gets id of student
 * @return the id of student
 */
    public int getId() {
        return studentId;
    }
    
/**
 * sets the number of credits enarned.
 * @param credits The new number of credits earned
 */
    public void setCredits(double credits) {
        creditsEarned = credits;
    }
    
/**
 * Gets the number of credits earned.
 * @return The number of credits this student has earned
 */    
    public double getCredits() {
        return creditsEarned;
    }
    
/**
 * Sets whether the student is paid up.
 * @param flag The value true or false indicating paid-up status
 */    
    public void setPaidUp(boolean flag) {
        paidUp = flag;
    }

/**
 * Returns whether the sutdent is paid up.
 * @return Whether the student is paid up.
 */
    public boolean isPaidUp() {
        return paidUp;
    }

/**
 * Creates a string identifying this student.
 * @return The string used to display this student.
 */
    public String toString() {
        return studentName + " (#" + studentId + ")";
    }

/* public constants */
    public static final double CREDITS_TO_GRADUATE = 32.0;
    
/* Private instance variables */
    private String studentName;        /* The student‘s name */
    private int studentId;            /* The student‘s id */
    private double creditsEarned;    /* The number of credits earned */
    private boolean paidUp;            /* Whether student is paid up */
 
}

Javadoc

/** 开头

@param 这种特殊的

 

可以通过 eclipse 等工具生成 java doc 文件.

也可以使用命令 javadoc Student.java 来生成说明文档 (在 Student.java 同一个目录下)

以上是关于Javadoc的主要内容,如果未能解决你的问题,请参考以下文章

mvn命令异常:An error has occurred in Javadoc report generation: Unable to find javadoc command异常已解决(代码片段

JavaDoc 中带注释的代码示例

在 javadoc 注释中编写代码 [重复]

手写Java代码并生成Javadoc文档

Intellij IDEA如何生成JavaDoc?

IntelliJIDEA中如何使用JavaDoc