Javadoc (for detailed usage, see the meaning of JDK or Baidu's specific Parameter Representation)

Source: Internet
Author: User

I. Purpose

In order to better combine code and documents and better manage code

Ii. Syntax

All javadoc commands can only start with "/**" comments, and end with "*/" like general comments. Use javadoc
There are two main methods: Embed HTML, or use "Doc tag )". The so-called "document tag" is
Commands starting with "@", and the "@" character must be placed at the beginning of the comment line (that is, after the leading "*" is ignored)
). The "inline Doc tag" can appear anywhere in the javadoc comment,
They also start with the "@" character, but must be enclosed in curly brackets.

 

There are three types of annotation documents, which correspond to the three elements after the annotation position: Class, variable, and method. That is
Class annotation is located just before the class definition; variable annotation is located just before the variable definition; and method definition is also located
Before the method definition. As shown in the following simple example:
 
/** A class comment */
Public class doctest {
/** A variable comment */
Public int I;
/** A method comment */
Public void F (){}
}
 
Note that javadoc can only annotate documents for "public (public)" and "protected (protected)" members."Private
(Private) "and comments of accessible members in the package will be ignored, so they will not be seen in the output results.
(However, you can use-private to mark the members so that they can be processed together ).
This makes sense because
Only public and protected members can be used outside the file, which is expected by the client programmer. As
All comments made to the class are included in the output result.

You can also set corresponding formats in myeclipse to facilitate code management.

 

Embedded HTML

 

Javadoc embeds the HTML command into the HTML document generated by it. This allows you to make full use of HTML
Yes. Of course, the main purpose is to format the code. The following is an example:
 
/**
* <PRE>
* System. Out. println (new date ());
* </PRE>
*/
 
 
You can also use HTML in other Web documents to format common text as described by yourself.

/**
* You can <em> even </em> insert a list:
* <Ol>
* <Li> item one
* <Li> item two
* <Li> item three
* </OL>
*/
 
Note: In document comments, asterisks and leading spaces at the beginning of each line are discarded by javadoc. Javadoc
All contents are reformatted to make them look the same as the standard document. Do not use titles in embedded HTML
For example, Disturbance.
 
All types of annotation documents-classes, variables, and methods-support embedded HTML.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.