Documentation Comment in java

Java Programming Language / Overview of Java Language

3120

The Java language supports three types of comments.

Sr.No. Comment & Description
1

/* text */

The compiler ignores everything from /* to */.

2

//text

The compiler ignores everything from // to the end of the line.

3

/**
* documentation */

This is a documentation comment and in general its called doc comment. The JDK javadoc tool uses doc comments when preparing automatically generated documentation.

Program:

 /**
* This is Documentation Section in java
* Program Name     : How to declare and initialize a variable 
* Program Author   : Rumman Ansari
* Program Date     : 12.02.2001
* output           : it will print value of variable j
*/
	
public class MultiLineComment {
public static void main(String[] args) {
/* it's a multiline comment, we are going to
declare and  print variable j . */
    int j=10;
    System.out.println(j);
 }
}

Output:

10
Press any key to continue . . .

Explanation:

Documentation comments in Java are special comments that begin with /** and end with */. These comments are used to document Java source code in a standardized format, known as JavaDoc. JavaDoc comments are used to generate API documentation, which describes the behavior of classes, methods, and fields in Java code.

JavaDoc comments can include a variety of information, including the author, version, and parameters of a method, as well as examples of how to use the method. JavaDoc comments are used to provide a clear and concise description of what a method does, what it expects as input, and what it returns as output.


This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.