How many types of java comments are there? Everybody knows there are two types of java comments available. Now the misunderstood part starts. What are those two types of java comments?
The (§3.7) Java Language Specification Third Edition says,
What happened to the documentation comment or javadoc comment?
No it is not a type by itself. This is a commonly misunderstood theory in Java. First lets go through the defintion of these two types of java comments as per specification.
1) Traditional Comment
/* text */
Definition: All the text from the ASCII characters /* to the ASCII characters */ is ignored (as in C and C++).
2) End of line Comment
Definition: all the text from the ASCII characters // to the end of the line is ignored (as in C++).
Java comments come with the following properties too:
Javadoc tool facilitates the extraction of text added in the java source code between /** and */. The syntax used is /** text */
Now the compiler point of view. When the java compiler encounters /* it ignores the text until it reaches */ Therefore irrespective, it might be /** or /*# or any other character java compiler doesn’t takes that into account. For the java compiler it is a traditional comment.
Therefore as per Java Language Specification Third Edition there is no special type as java documentation comment.