Java Method Document Markup

Source: Internet
Author: User

In addition to embedding HTML and @see references, methods allow you to use document tags for parameters, return values, and violations.

1. @param
The format is as follows:
@param parameter Name Description
where "parameter name" refers to an identifier within the parameter list, and "description" represents some descriptive text that can be persisted to subsequent lines. Once a new document tag is encountered, the previous description is considered to end. You can use any number of descriptions, one for each parameter.

2. @return
The format is as follows:
@return Description
Where "description" refers to the meaning of the return value. It can be extended to the back of the line.

3. @exception
Details of the "contravention" (Exception) will be covered in chapter 9th. In short, they are special objects that, if a method fails, can be "thrown out" of the object. When a method is invoked, although only one of the offending objects appears, some special methods may produce any number of different types of violations. All these violations need to be explained. Therefore, the format of the offence markings is as follows:
@exception Full class name description
The "Full class name" explicitly specifies the name of an offending class, which is defined elsewhere. The "description" (which also extends to the line below) tells us why this particular type of violation appears in the method call.

4. @deprecated
This is a new feature of Java 1.1. This tag is used to indicate that some of the old features have been replaced by new, improved functionality. The role of this tag is to recommend that users do not have to use a particular feature, because it may be discarded in future revisions. If you mark a method as @deprecated, you receive a warning from the compiler when you use this method.

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.