Home > Java > Javagetting Started > body text

How to comment in java

(*-*)浩
Release: 2019-11-14 11:03:32
Original
3823 people have browsed it

How to comment in java

Comment: It is the explanation of the meaning of the code

There is a lot of code and it is easy to forget, please add annotations and explanations-> What developers and maintainers see, not what the platform computer sees

In Java, there are three ways to mark comments: /Comments cannot be nested. In other words, you cannot simply use /* and & & & & #& & (Recommended learning: java course)

//Single-line comments

System.out.println("welcome CSDN");//打印输出welcome CSDN
Copy after login

Multi-line comments:/* &#&*/

public class HelloWorld{
	/*
	*main方法程序的入口
	*/
	public static void main(String[]args){
	}
}
Copy after login

Documentation comment: /**&#&*/

package com.bdqn.output;
/** 
*@version 1.1
*@author 王靖文
*/
	public class HelloWorld{
		public static void main(String[]args){
		System.out.println("welcome CSDN");
	}
}
Copy after login

Warning: In Java, /** &*/ is enclosed as a comment because the code itself may also contain a */.

The above is the detailed content of How to comment in java. 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