Java generates javadoc

Source: Internet
Author: User
1. Introduction to javadoc

We usually see javadoc. The javase API document is a javadoc. Obviously, javadoc aims to allow external customers to understand our code and use our external interfaces.

Remember: When writing javadoc, you only need to write external interfaces, and do not need internal interfaces to write javadoc comments;

Ii. javadoc comments

Generally, our annotation form is:

(1 )//

(2 )/**/

The javadoc comments are as follows:

/** *  * @return */

Note: it must start;

Iii. Generate javadoc documents by ECLIPSE

1. Write javadoc comments

In eclipse, if you enter/** before a method and press enter, the javadoc annotation format is automatically generated, for example:

public void setAge(int age) {this.age = age;}

Enter/** in the previous line of the code and press enter to generate the following comments:

/** *  * @param age  */public void setAge(int age) {this.age = age;}
2. Generate javadoc comments

If you want to generate a file or project's javadoc file, right-click it and click Export. Then select javadoc to generate javadoc;

(Encoding may occur. For example, a browser does not contain garbled characters, while a browser may contain garbled characters. For example, Safari is garbled and IE is not garbled characters in the Chinese documents generated by me );

Iv. Example

The Code is as follows:

/*** Create a person object. * @ Param name * @ Param age * @ return person object */public static person getinstance (string name, int age) {return new person (name, age );}

The generated format is as follows:

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.