The so-called comments are descriptions and explanations of the code. They are for people to read and will not be processed by the compiler according to Java syntax. Therefore, they can be written in Chinese and can be written at will, but format constraints are required. Then it supports the following three types:
1. Line comments
Starting with // means that this line is all comments, such as:
//The weather is very good today publicclassMain{publicstaticvoidmain(String[]args){System.out.println(Hiwww.dotcpp.com);}}
2. Paragraph comments
It starts with /* and ends with */. Everything in between will be treated as comments. It is suitable for comment information with large content and multi-line display, such as:
/*The weather is very good today, the sun is shining in the sky and the flowers are smiling at me*/publicclassMain{publicstaticvoidmain(String[]args){System.out.println(Hiwww.dotcpp.com);}}
3. Document comments
It starts with /** and ends with */. Different from paragraph comments, document comments will archive the content between /** and */ in javadoc, which will be recognized and displayed in the generated Html report, and used to record program information. , usually document comments are used at the beginning of classes, methods, and modules, which also support using @ to identify various tags.
/**Author:HuangData:2021/9/25*/publicclassMain{publicstaticvoidmain(String[]args){System.out.println(Hiwww.dotcpp.com);}}