我们知道Java中有三种注释语句:
1.//用于单行注释。
2./*...*/用于多行注释,从/*开始,到*/结束,不能嵌套。
3./**...*/则是为支持jdk工具javadoc.exe而特有的注释语句。
javadoc工具能从java源文件中读取第三种注释,并能识别注释中用@标识的一些特殊变量(见表),制作成Html格式的类说明文档。 javadoc不但能对一个java源文件生成注释文档,而且能对目录和包生成交叉链接的html格式的类说明文档,十分方便。 注释中可以出现的关键字,以@开头:
@author 作者名
@version 版本标识
@parameter 参数名及其意义
@since 最早出现的JDK版本
@return 返回值
@throws 异常类及抛出条件
@deprecated 引起不推荐使用的警告
@see 交叉参考 下面是javadoc.exe的用法 C:\java>javadoc -help C:\java>javadoc -help usage: javadoc [options] [packagenames] [sourcefiles] [classnames] [@files]
-overview <file> Read overview documentation from HTML file
-public Show only public classes and members
-protected Show protected/public classes and members (default)
-package Show package/protected/public classes and members
-private Show all classes and members
-help Display command line options and exit
-doclet <class> Generate output via alternate doclet
-docletpath <path> Specify where to find doclet class files
-sourcepath <pathlist> Specify where to find source files
-classpath <pathlist> Specify where to find user class files
-exclude <pkglist> Specify a list of packages to exclude
-subpackages <subpkglist> Specify subpackages to recursively load
-breakiterator Compute 1st sentence with BreakIterator
-bootclasspath <pathlist> Override location of class files loaded by the bootstrap class loader
-source <release> Provide source compatibility with specified release
-extdirs <dirlist> Override location of installed extensions
-verbose Output messages about what Javadoc is doing
-locale <name> Locale to be used, e.g. en_US or en_US_WIN
-encoding <name> Source file encoding name
-J<flag> Pass <flag> directly to the runtime system Provided by Standard doclet:
-d <directory> Destination directory for output files
-use Create class and package usage pages
-version Include @version paragraphs
-author Include @author paragraphs
-docfilessubdirs Recursively copy doc-file subdirectories
-splitindex Split index into one file per letter
-windowtitle <text> Browser window title for the documenation
-doctitle <html-code> Include title for the overview page
-header <html-code> Include header text for each page
-footer <html-code> Include footer text for each page
-bottom <html-code> Include bottom text for each page
-link <url> Create links to javadoc output at <url>
-linkoffline <url> <url2> Link to docs at <url> using package list at <url2>
-excludedocfilessubdir <name1>:.. Exclude any doc-files subdirectories with given name.
-group <name> <p1>:<p2>.. Group specified packages together in overviewpage
-nocomment Supress description and tags, generate only declarations.
-nodeprecated Do not include @deprecated information
-noqualifier <name1>:<name2>:... Exclude the list of qualifiers from the output.
-nosince Do not include @since information
-nodeprecatedlist Do not generate deprecated list
-notree Do not generate class hierarchy
-noindex Do not generate index
-nohelp Do not generate help link
-nonavbar Do not generate navigation bar
-quiet Do not display status messages to screen
-serialwarn Generate warning about @serial tag
-tag <name>:<locations>:<header> Specify single argument custom tags
-taglet The fully qualified name of Taglet to register -tagletpath The path to Taglets
-charset <charset> Charset for cross-platform viewing of generated documentation.
-helpfile <file> Include file that help link links to
-linksource Generate source in HTML
-stylesheetfile <path> File to change style of the generated documentation
-docencoding <name> Output encoding name C:\java>
下面请看用javadoc生成的文档(请点击本页上面的观看演示链接)
生成文档: C:\java>javadoc JavadocDemo.java
Loading source file JavadocDemo.java...
Constructing Javadoc information...
Standard Doclet version 1.4.2_03
Generating constant-values.html...
Building tree for all the packages and classes...
Building index for all the packages and classes...
Generating overview-tree.html...
Generating index-all.html...
Generating deprecated-list.html...
Building index for all classes...
Generating allclasses-frame.html...
Generating allclasses-noframe.html...
Generating index.html...
Generating packages.html...
Generating JavadocDemo.html...
JavadocDemo.java:11: warning - Tag @see: reference not found: javax.swing.Japplet
Generating serialized-form.html...
Generating package-list...
Generating help-doc.html...
Generating stylesheet.css...
1 warning C:\java>
附源文件:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/**
*JavadocDemo.java,一个显示JavaDoc注释的Applet
*<p>注意这只是HelloApplet的一个带注释的版本
*@see java.applet.Applet
*@see javax.swing.Japplet
*/ public class JavadocDemo extends Applet{ /** init()是一个Applet方法,由浏览器调用进行初始化
* 只调用一次
* @return 无
*/
public void init(){
//创建并添加一个按钮
//其它什么也不做
Button b;
b=new Button("Hello");
add(b);
show();
} /** paint() 是一个AWT组件方法,在组件要绘制时调用,只
* 是在Applet的窗口中画带色的方框。
* 参数 g一个java.awt.Graphics
* 用在所有绘制方法中
*/ public void paint(Graphics g){
int w=getSize().width,h=getSize().height;
g.setColor(Color.yellow);
g.fillRect(0,0,w/2,h);
g.setColor(Color.green);
g.fillRect(w/2,0,w,h);
g.setColor(Color.black);
g.drawString("Welcome to Java",50,50);
} /** show()用于使组件可见,此方法在
* JDK1.1中被归入不推荐使用
*@since 1.0
*deprecated换用setVisible(true)
*/ public void show(){
//由于覆盖了show(),此applet 不能显示
} /** Applet必须有一个公共的无参数构造方法
*@throws java.lang.IllegalArgumentException
*/ public JavadocDemo(){
if(new java.util.Date().getDay()==0){
throw new IllegalArgumentException("Never on a Sunday");
}
}
}

JAVADOC 常见使用方法 帮助文档的更多相关文章

  1. javadoc 工具生成开发API文档

    =====================先来一点成就感===================== package com.springMybatis.dao; import com.springMy ...

  2. WdatePicker.js的使用方法 帮助文档 使用说明(时间控件)

    WdatePicker.js的使用方法 帮助文档 使用说明(时间控件)   4. 日期范围限制 静态限制 注意:日期格式必须与 realDateFmt 和 realTimeFmt 一致 你可以给通过配 ...

  3. 【转】WdatePicker.js的使用方法 帮助文档 使用说明 如何使用

    [转]WdatePicker.js的使用方法 帮助文档 使用说明 如何使用 日期控件支持平面显示功能,只要设置一下eCont属性就可以把它当作日历来使用了,无需触发条件,直接显示在页面上 示例2-1 ...

  4. javadoc 自动生成java帮助文档

    用法: javadoc [options] [packagenames] [sourcefiles] 选项: -public 仅显示 public 类和成员 -protected 显示 protect ...

  5. jQuery 核心 - noConflict() 方法,jQuery 文档操作 - detach() 方法

    原文地址:http://www.w3school.com.cn/jquery/manipulation_detach.asp   实例 使用 noConflict() 方法为 jQuery 变量规定新 ...

  6. eclipse中javadoc给项目生成api文档

    步骤 1.打开java代码,编写JavaDoc 注释,只有按照java的规范编写注释,才能很好的生成API文档,javadoc注释与普通注释的区别为多一个*(星号).普通代码注释为/*XXX*/,而j ...

  7. linux中使用head,tail,grep, sed,awk三种方法显示文档中间若干行(指定任意行)

    需要显示文本中间20-25行. 创建一个30行的文档,命名为30.txt并显示在屏幕 [root@v2-ui data]# seq 30 > 30.txt && cat 30.t ...

  8. C#连接各种数据库的方法(文档)

    1.C#连接连接Access程序代码: ------------------------------------------------------------------------------- ...

  9. WdatePicker.js的使用方法 帮助文档 (日历控件)

    WdatePicker配置和功能 一.配置 日期范围限制 静态限制 注意:日期格式必须与 realDateFmt 和 realTimeFmt 一致 你可以给通过配置minDate(最小日期),maxD ...

随机推荐

  1. Graphics2D 中文乱码

    今天遇到了一个乱码问题,合成的小票图片上的中文全部变成了口口口,后来在网上查了资料,发现是Graphics2D用了宋体字,而linux服务器上没有对应的字体库. 把本地的字体库上传上去就解决了. 本地 ...

  2. C++构造函数 & 拷贝构造函数 & 派生类的构造函数 & 虚继承的构造函数

    构造函数 ,是一种特殊的方法 .主要用来在创建对象时初始化对象, 即为对象成员变量赋初始值,总与new运算符一起使用在创建对象的语句中 .特别的一个类可以有多个构造函数 ,可根据其参数个数的不同或参数 ...

  3. z-index的最大值、最小值

    浏览器 最大值 超过最大值后变成 最小值 小于最小值后变成 备注 IE6 2147483647 2147483647 -2147483648 -2147483648   IE7 2147483647 ...

  4. win8 在哪找画图工具

    把鼠标放在右上角,然后往下拉,出现搜索图标,如图: 在‘搜索’输入‘画图’ 打开即可使用.

  5. 通过Linux系统Cron执行OwnCloud计划任务

    通过Linux系统Cron执行OwnCloud计划任务 02/02/2013 CRON的确是一个非常有用的功能,它有效减少了系统的负载,在将WordPress和StatusNet的任务计划都转换到Cr ...

  6. eclipse中格式化代码快捷键Ctrl+Shift+F失效的解决办法

    很长一段时间我的eclipse都有个毛病,就是当我要格式化代码的时候,右键-source-format能够起效,但ctrl+shift+f不好使了. 可以基本断定是快捷键与别的软件冲突了,但一直也没时 ...

  7. 【HDOJ】1315 Basic

    这道题目巨坑啊,注意__int64,int wa了一个下午. #include <cstdio> #include <cstring> #include <cstdlib ...

  8. 【转】DELL戴尔N4050笔记本拆机(图文)

    原文网址:http://www.ywxydn.com/1047.html

  9. servlet过滤器配置白名单、黑名单

    1.web.xml配置 <filter> <description>过滤是否登陆</description> <filter-name>encoding ...

  10. 深入解读ESB与SOA的关系

    时至今日,SOA的概念渐渐清晰了.   有关ESB的概念,已经吵了好多年了,还是没有定论. 我个人认为,ESB本来就是抽象的概念,而且内涵丰富,在不同的场合含义不同.因此应该从不同的角度来认识.   ...