Java annotations

  1. single line comment
  2. multi-line comment
  3. Documentation Notes

Single-line comments : add a double slash (//) before the content that needs to be commented

Multi-line comments: enclose the content that needs to be commented with /* */

Documentation comments : /** */ Documentation comments are used to generate API documentation (using javadoc to generate), API documentation is mainly used to describe the functions of classes, member variables, and methods. Therefore, the javadoc tool only processes comments before classes, interfaces, inner classes, member variables, methods, and constructors. Moreover, methods or member variables modified with private by default do not generate comment documentation unless the -private parameter is added when using the javadoc tool.

 

Basic usage of javadoc tool:

  javadoc A bunch of parameter java source files (or packages)

The available parameters are:

-d <directory> specifies the directory where the generated API documentation will be placed

-windowtitle <text> Sets the browser window title for the API documentation

-author Show author in the document (requires the author to be specified in the comments)

-version show version in documentation

-charset specifies the encoding of the API document, such as -charest utf-8

For more parameters, use javadoc --help (linux system) to view

 

Some tags you can use when writing documentation comments:

@author author

@version version

Parameter description of the @param method

The return value of the @return method

@see see, specify reference content

@exception the type of exception thrown

@throws is the same as exception

 

You can create a package.html in each package to describe the package, and then directly extract the comments of all classes in the package into the API documentation through a bunch of parameter packages in javadoc

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325066930&siteId=291194637