JAVA- basis - Notes

First, the concept of annotation

  Program posters message, comment will be ignored by the compiler, without any influence in the process of compiling and executing the program, only prompt information when reading the code.

 

Second, as comments

  1. Line Comments

    The basic syntax:

        1 // After the double slash to the end of the contents of the current line is commented out 

  2. Note block

    The basic syntax:

      

1  / * 
2  * My comment is a
 3  * I also annotated the
 4  * I have the same
 5  * /    

  3. Documentation Comments

    The basic syntax:

  

1  / * 
2  * comment is typically used to declare a document class, method, function attribute
 3  * documentation comments in use, prohibit the use of nested   
 4  * part of the document may be annotated to the document when generating the document extracted by the command javadoc   
 5  * /

Experiment: Write a class with document annotation and generate a document by document extraction tool

  1) write Person.java, note that the class must be public, and the class name and the file name must be identical

    

1  / * 
2    This is a representative of the class
 . 3  * / 
. 4  public  class the Person { // declare a class called the Person 
. 5    public  static  void main (String args []) {
 . 6      / * 
. 7      Moonlight
 8      suspected ground frost
 9      raise eyes to the moon
 10      down think of home    
 . 11      * / 
12 is      System.out.println ( "Hello World ~" );
 13 is    }
 14 }

  2) by javadoc command, extract document

    

  3) view the document extracted

  

 

 

Guess you like

Origin www.cnblogs.com/xiaoluohao/p/11294781.html