前言: Java 代码中的大多数普通注释都解释了该代码的实现细节。相反,Java 语言规范定义了一种特殊类型的注释,称为文档
Java 代码中的大多数普通注释都解释了该代码的实现细节。相反,Java 语言规范定义了一种特殊类型的注释,称为文档注释,用于记录代码的 API。
文档注释是一个普通的多行注释,以/**(而不是通常的/*)开头并以*/结尾. 文档注释出现在类、接口、方法或字段定义之前,并包含该类、接口、方法或字段的文档。文档可以包括简单的 HTML 格式标记和其他提供附加信息的特殊关键字。文档注释会被编译器忽略,但它们可以被javadoc 程序提取并自动转换为在线 HTML 文档。这是一个包含适当文档注释的示例类: docstore.mik.ua/orelly/java-ent/jnut/ch07_03.htm
/**
* This immutable class represents complex
* numbers. *
* @author David Flanagan
* @version 1.0
*/
public class Complex {
/**
* Holds the real part of this complex number.
* @see #y
*/
protected double x;
/**
* Holds the imaginary part of this complex number.
* @see #x
*/
protected double y;
/**
* Creates a new Complex object that represents the complex number
* x+yi.
* @param x The real part of the complex number.
* @param y The imaginary part of the complex number.
*/ public Complex(double x, double y) { this.x = x; this.y = y; }
/**
* Adds two Complex objects and produces a third object that represents
* their sum.
* @param c1 A Complex object
* @param c2 Another Complex object
* @return A new Complex object that represents the sum of
* c1 and
* c2.
* @exception java.lang.NullPointerException
* If either argument is null.
*/ public Complex add(Complex c1, Complex c2) { return new Complex(c1.x + c2.x, c1.y + c2.y); } } docstore.mik.ua/orelly/java-ent/jnut/ch07_03.htm
文章出自:http://qh.itpxw.cn/peixun/software/2022121746.html
文章标题:Java文档注释
免责声明:本站文章均由入驻起航学习网的会员所发或者网络转载,所述观点仅代表作者本人,不代表起航学习网立场。如有侵权或者其他问题,请联系举报,必删。侵权投诉
IT培训网 访问该机构站点 报名留言 加为好友 用户等级:注册会员
用户级别:10
机构名称:IT培训网
联 系 人:罗老师
联系电话:13783581536
联系手机:13783581536
在线客服:
在 线 QQ:
电子邮件:
网站域名:http://www.itpxw.cn
注册时间:2016-07-18 11:07
最后登录:2024-02-20 13:02
Java定义方法的格式是什么?IT培训网小编来告诉大家。所谓方法...
大家在Java教程中会学到关于Java消息推送的知识,那么,Java消息...
常用的Java日期格式转换有哪些?IT培训网小编来告诉大家。 1...
Java创建对象数组的方法是什么?IT培训网小编来告诉大家。Ja...