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

What are single-line comments in Java programs?

藏色散人
Release: 2020-09-17 15:21:01
Original
15926 people have browsed it

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):

// ...
Copy after login

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:

// 这是一条单行注释
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template