javadoc | Creating API Documention in Java
Last Updated : 18 Feb 2026
In this chapter, we will learn how to use Javadoc to create professional API documentation.
What is Javadoc?
Javadoc is a powerful tool provided by Java to generate HTML-based API documentation directly from your source code comments.
With Javadoc, you can describe classes, methods, constructors, and fields using special documentation comments. These comments are then converted into well-structured, easy-to-read web pages that can be shared with developers or users of your API.
Example: Creating Javadoc for a Simple Class
Let's create a simple Java class with Javadoc comments to document a method that calculates the cube of a number.
Explanation
- The comment starting with /** ... */ is a Javadoc comment.
- The class M has a Javadoc description explaining its purpose.
- The method cube(int n) also has a Javadoc comment with a description and a @param tag for the method parameter.
- You can generate HTML documentation using the javadoc tool, which will produce a professional API document for this class.
How to Generate Javadoc?
- The comment starting with /** ... */ is a Javadoc comment.
- The class M has a Javadoc description explaining its purpose.
- The method cube(int n) also has a Javadoc comment with a description and a @param tag for the method parameter.
- You can generate HTML documentation using the javadoc tool, which will produce a professional API document for this class.
Subscribe to Tpoint Tech
We request you to subscribe our newsletter for upcoming updates.