Reprinted from: http://blog.163.com/hui_san/blog/static/5710286720104191100389/
Objective
Java's syntax is similar to C + +, so do you know how many Java annotations there are?
1)//Comment Line
2)/*/... * * Comment several lines
3)/** ... * * Comment several lines and write to Javadoc document
Usually the multiline notation of this comment is as follows:
/**
* .........
* .........
*/
What is the use of this third annotation? What is Javadoc again? Well, then let me tell you--
I. Java documentation and Javadoc
Java programmers should know that using JDK development, the best help information comes from SUN's published Java documentation. It provides the help information of various parties ' laws and attributes in detail, with detailed tree information, index information and so on, and provides relationships among many related classes, such as inheritance, implementation interface, reference, etc.
Java documents are all organized by some HTML files, and they can be downloaded on a SUN site. But you can't imagine that we can generate these documents ourselves.
After installing the JDK, there is a Src.jar file or Src.zip file in the installation directory, which is compressed in zip format and can be decompressed using WINZIP. After unpacking, we can see that the sub-directory is full of. java files. Yes, these are the Java operating class source, very complete, even the comments are written clearly ... But how does it feel to be familiar with these notes?
It's not surprising that our fans are about to unravel. If you take a closer look at the document comments in the Java source file (/** ... */) and the contents of the Java documentation, you will find that they are the same. The Java documentation is just a little bit more in formatting and typography. More carefully, you will find. Comments in the Java source file also come with HTML identifiers, such as <B>, <BR>, <Code>, and so on, where these identities appear in the Java documentation, and are already formatted as defined by the identity.
Finally, it looks like the original Java document came from these comments. No wonder these comments are called document annotations! But what tools turn these annotations into documents?
It's time to come out of the Javadoc. In the bin directory of the JDK you can find Javadoc, if it is a JDK under Windows, its file name is Javadoc.exe. When compiling a. Java source file using Javdoc, it reads out the document comments in the. Java source file and compiles it along with the Java source program according to certain rules, generating the document.
Before you introduce the compiler commands for Javadoc, let's look at the format of the document comments. But to be able to compile some of the examples described below, here is a Javadoc command:
javadoc-d Document storage directory-author-version source file name. Java
This command compiles a Java source file named "source file name. Java" and stores the resulting document in the directory specified in the "document Directory" where the index.html is the first page of the document. -author and-version two options can be omitted.
[Java Basics] Documentation notes