The Java tool that generates documentation from source code is javadoc.
The command reads Java source files, especially their documentation comments, and processes them through a doclet. When no alternative doclet is selected, the Standard Doclet usually generates HTML API documentation containing packages, classes, constructors, methods, fields, inheritance details, and linked references.
Javadoc comments use the /** ... */ form and can include tags such as @param, @return, @throws, and @since. The tool is therefore more than a generic source-code formatter: it turns structured comments and program declarations into navigable reference material. Projects can also provide custom doclets to generate other formats or specialized reports.
Several Java tools are easy to mix up. javac compiles source into bytecode, javap disassembles or inspects compiled class files, and jshell provides an interactive Java programming environment. javadoc can document source declarations without compiling the application itself, although a project build may run it as part of its documentation phase.