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 同一个目录下)

原文地址:https://www.cnblogs.com/moveofgod/p/12285016.html