Web-android Engineer first-2-12 How to use annotations in Java

Source: Internet
Author: User

Source: http://www.imooc.com/code/1274

When you write a program, you often need to add some comments to describe the role of a piece of code.

In general, for a specification of the program source code, the note should be accounted for more than 1/3 of the source code. Therefore, note is an important part of the program source code, we must pay attention to Oh!

There are three types of annotations in Java: single-line comments, multiline comments, document annotations

Operation Result:

Look: The annotated code block will not be executed while the program is running ~ ~

We can use the Javadoc command to extract the content from the documentation comments and generate the program's API help documentation.

Open the home page to view the generated API documentation

PS: You can also use the Javadoc tag When using document annotations to generate more detailed document information:

@author identify the author of the development of such modules

@version indicate the version of the module

@see reference steering, i.e. related topics

@param a description of a parameter in the method

@return Description of the return value of the method

@exception description of the exceptions that the method might throw

Task

Pro, do you know how to add a note?

In the editor, use a single-line comment to comment out the code in line 3rd, using a multiline comment to comment out the code in lines 5th and 62

Operation Result:

 1  public  class   helloworld{ public  static  void   main (string[] args) { 3  System.out.println ("Java" ); 4  System.out.println ("Imooc" );  5  System.out.println ("Oracle"  6  System.out.println ("MySQL"  7   8  }

1  Public classhelloworld{2      Public Static voidMain (string[] args) {3         //System.out.println ("Java");4System.out.println ("Imooc");5         /*System.out.println ("Oracle");6 System.out.println ("MySQL");*/7     }8}

Web-android engineer first-2-12 How to use annotations in Java

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.