Home  >  Article  >  Java  >  How to comment in java

How to comment in java

(*-*)浩
(*-*)浩Original
2019-11-14 11:03:323828browse

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

Multi-line comments:/* &*/

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

Documentation comment: /**&*/

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

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!

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 java queueNext article:What is java queue