Javadoc comments are special multi-line comments in Java used to generate professional HTML documentation for classes, methods, constructors, and fields. They are widely used in enterprise and Advance Java projects.
/** ... */ syntax@param, @return, @authorJavadoc comments must be placed immediately before the class, method, constructor, or variable declaration. Each tag has a specific purpose.
/** This class demonstrates basic Javadoc usage */
public class Calculator {
/**
* Adds two integers
* @param a first number
* @param b second number
* @return sum of a and b
*/
public int add(int a, int b) {
return a + b;
}
}
Running the javadoc command generates HTML pages showing:
@param and @returnjavadoc ClassName.java