Java annotation Format

Source: Internet
Author: User
Tags class definition

All Javadoc commands can only appear in the "/**" comment. But peace is always the same, the annotation ends with a "* *". There are two main ways to use Javadoc: embedded HTML, or use document markup. where document tags (doc tags) are commands that begin with "@" and are placed at the beginning of the comment line (but the leading "*" is ignored).
There are three types of annotation documents that correspond to the elements that are behind the annotation: class, variable, or method. That is, a class annotation is just before a class definition, the variable annotation is just before the variable definition, and a method definition is right in front of a 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 Javadoc can only process the annotation document for public and protected (protected) members. Comments for members of private and friendly (see chap. 5) are ignored, and we do not have any output (and can also include private members with-private tags). This makes sense because only public and protected members can be used outside of the file, which is the hope of the client programmer. However, all class annotations will be included in the output result.
The output of the above code is an HTML file that has the same standard format as other Java documents. As a result, users are very familiar with this format and can easily "roam" through the classes you design. When you design your program, be sure to consider entering the code above and using Javadoc to see how the final HTML file will look.

Related Article

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.