Home>Article>Java> What are single-line comments in Java programs?

What are single-line comments in Java programs?

Barbara Streisand
Barbara Streisand Original
2019-05-22 11:29:30 15795browse

Comments in the program are an important means of communication between software designers/software developers and program readers. Good specifications and good execution specifications are particularly important for the software itself and software developers.

What are single-line comments in Java programs?

In the life cycle of software, good comments can improve the readability of the code and enable developers to understand the code left by their predecessors as soon as possible (many of which use clever Algorithms with poor readability); Furthermore, it can standardize the code to the maximum extent and improve the efficiency of teamwork; Secondly, long-term compliance with coding standards can develop developers' good coding habits and more rigorous thinking; and, in the thinking of agile development even proposed the concept of converting comments into code.

What are the single-line comment characters in Java programs?

Java single-line comment methods and formats

Single-line comments (or short comments):

// ...

Single-line comments originated from C, with a Starting with "//" means that all the contents of this line are comments. This type of comment is more commonly used because it is more convenient to write. There is no need to search for a "/" and then a "*" on the keyboard (just press the same key twice), and there is no need to add a closing tag at the end of the comment. The following is an example of this type of annotation:

// 这是一条单行注释

Related learning recommendations:java basic tutorial

The above is the detailed content of What are single-line comments in Java programs?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:what is interface in java Next article:what is interface in java