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: