It is possible to create package-level documentation in Javadocs using a file called package-info.java
. This file must be formatted as below. Leading whitespace and asterisks optional, typically present in each line for formatting reason
/**
* Package documentation goes here; any documentation before the first period will
* be used as a summary.
*
* It is common practice to leave a blank line between the summary and the rest
* of the documentation; use this space to describe the package in as much detail
* as is appropriate.
*
* Inline tags such as {@code code here}, {@link reference.to.other.Documentation},
* and {@literal text here} can be used in this documentation.
*/
package com.example.foo;
// The rest of the file must be empty.
In the above case, you must put this file package-info.java
inside the folder of the Java package com.example.foo
.