Java注释
Java语言支持三种类型的注释-
编译器将忽略从/*到*/的所有内容。
编译器将忽略////到行尾的所有内容。
这是一个文档注释,通常称为doccomment。在准备自动生成的文档时,JDKJavadoc工具使用文档注释。
以下是一个简单示例,其中/*...*/中的行是Java多行注释。类似地,//继续的行是Java单行注释。
示例
/**
* The HelloWorld program implements an application that
* simply displays "你好,世界!" to the standard output.
*
* @author Zara Ali
* @version 1.0
* @since 2014-03-31
*/
public class HelloWorld {
//标准主要方法
public static void main(String[] args) {
/* Prints Hello, World! on standard output. */
System.out.println("你好,世界!");
}
}您可以在描述部分中包含必需的HTML标记。例如,以下示例将<h1>....</h1>用于标题,并将<p>用于创建段落中断-
示例
/**
* <h1>Hello, World!</h1>
* The HelloWorld program implements an application that
* simply displays "你好,世界!" to the standard output.
* <p>
* Giving proper comments in your program makes it more
* user friendly and it is assumed as a high quality code.
*
*
* @author Zara Ali
* @version 1.0
* @since 2014-03-31
*/
public class HelloWorld {
//标准主要方法
public static void main(String[] args) {
/* Prints Hello, World! on standard output.*/
System.out.println("你好,世界!");
}
}