Home  >  Article  >  Java  >  What are the three forms of java annotations?

What are the three forms of java annotations?

王林
王林Original
2020-10-20 10:53:5033230browse

The three forms of java comments are: 1. Single-line comments, such as [//single-line comments]; 2. Multi-line comments, such as [/*multi-line comments*/]; 3. Document comments, like【/**@author*/】.

What are the three forms of java annotations?

JAVA comments have three forms: single-line comments, multi-line comments, and document comments.

(Recommended tutorial: java course)

1. Single-line comment

public class  online{
	public static void main(String[] args) {
		//这是一个单行注释
		System.out.println("Hello World!");
	}
}

2. Multi-line comment

public class  online{
	public static void main(String[] args) {
		/*
		这是一个多行注释
		*/
		System.out.println("Hello World!");
	}
}

3. Documentation comments

public class  online{
	public static void main(String[] args) {
		/**
		@author a_hasaigei
		@version 1.0
		这是一个文档注释
		是用来生成帮助文档的
		文档注释,是一种特殊的多行注释
		*/
		System.out.println("Hello World!");
	}
}

Related recommendations:Getting started with java

The above is the detailed content of What are the three forms of java annotations?. 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