*/". 3. Document comments, included between "/**"and"*/", can also comment on multiple lines of content. They are generally used on classes, methods and variables to describe their functions. The syntax is "/**", the next one will also be scanned"*/".Three forms of java comments: 1. Single-line comments, marked with double slashes "//", can only comment one line of content, and are used in places with little comment information. The syntax is "//"and" ". 2. Multi-line comments, included between "/*Annotation content*/", can comment on many lines of content, the syntax is "/*
"and"
The operating environment of this tutorial: windows7 system, java8 version, DELL G3 computer.
Comments are descriptions of the programming language, which facilitate communication between developers and users and facilitate understanding of the program. Comments are not programming statements and therefore are ignored by the compiler.Java supports three comment methods:
1) Single-line comment
Identified by double slashes "
", only one line of content can be commented, and it is used in places with little information content. Open Eclipse and use single-line comments in the Java code, as shown in Figure 1.
Figure 1 Single-line comment
2) Multi-line commentis included in "
/*
"and"
", many lines of content can be commented. For better readability, generally no comment information is written in the first and last lines (this is also more beautiful and beautiful), as shown in Figure 2.
Note: Multi-line comments can nest single-line comments, but multi-line comments and document comments cannot be nested.
Figure 2 Multi-line comments
3) Documentation commentsare included in "
/**## "#&
*/
In Java, a line of comments is identified by double slashes "//"; multi-line comments are included between "/*&*/"; documentation comments are included between " /**&*/"between.
When the compiler executes to "//", it will ignore all text after the line "//"; when it executes to "/*", it will scan the next "*/" and ignore "/* &*/"; when executing to "/**&*/" and ignore any text content between "/**&*/".
For more programming-related knowledge, please visit:Programming Teaching
! ! ###The above is the detailed content of What are the three forms of java comments?. For more information, please follow other related articles on the PHP Chinese website!