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