Java Documentation

Documentation Comments.

Java supports both C-style block comments delimited by /* and */ and C++-style line comments indicated by //:
/*  This is a
      comment.    */

  // This is a single-line comment
  // and so // is this

Javadoc Comments.

  • A block comment beginning with /** indicates a special doc comment.
  • A doc comment is terminated by the next */
  • lines beginning with @ are interpreted as special instructions.
  • You can then use the javadoc tool to creates HTML documentation for all classes and interfaces.
    Javadoc comment tags:
    Tag Description Applies to
    @see Associated class name Class, method, or variable
    @author Author name Class
    @version Version string Class
    @param Parameter name and description Method
    @return Description of return value Method
    @exception Exception name and description Method
    @deprecated Declares an item to be obsolete Class, method, or variable
    @since Notes API version when item was added Variable
    Javadoc Comments program example:
         * I think this class is possibly the most amazing thing you will
         * ever see. Let me tell you about my own personal vision and
         * motivation in creating it.
         * <p>
         * It all began when I was a small child, growing up on the
         * streets of Idaho. Potatoes were the rage, and life was good...
         * @see PotatoPeeler
         * @see PotatoMasher
         * @author kaare
         * @version 1.00, 19. jan 2009
    public class Main {
      public static void main(String[] args) {
        System.out.print("It is only a demo!");
    Using javadoc command on this program gives this documentation.
© 2010 by Finnesand Data. All rights reserved.
This site aims to provide FREE programming training and technics.
Finnesand Data as site owner gives no warranty for the correctness in the pages or source codes.
The risk of using this web-site pages or any program codes from this website is entirely at the individual user.