Documenting Java Code with Javadoc


Javadoc comments (/** … */) are used to document Java classes, methods, and fields. Javadoc tools can generate HTML documentation from these comments.

Source Code

/**
 * Represents a person.
 */
public class Person {
    /**
     * The person's name.
     */
    private String name;

    /**
     * Gets the person's name.
     *
     * @return The name of the person.
     */
    public String getName() {
        return name;
    }
}

Regularly document your Java code with Javadoc comments to provide clear and useful information to other developers and your future self.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments