我们知道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 Read overview documentation from HTML file-public Show only publicclasses and members-protected Show protected/public classes and members (default)-package Show package/protected/publicclasses and members-privateShow all classes and members-help Display command line options and exit-doclet Generate output via alternate doclet-docletpath Specify where to find doclet classfiles-sourcepath Specify where to find source files-classpath Specify where to find user classfiles-exclude Specify a list of packages to exclude-subpackages Specify subpackages to recursively load-breakiterator Compute 1st sentence with BreakIterator-bootclasspath Override location of class files loaded by the bootstrap classloader-source Provide source compatibility with specified release-extdirs Override location of installed extensions-verbose Output messages about what Javadoc is doing-locale Locale to be used, e.g. en_US or en_US_WIN-encoding Source file encoding name-J Pass directly to the runtime system

Provided by Standard doclet:-d Destination directory foroutput files-use Create class and packageusage pages-version Include @version paragraphs-author Include @author paragraphs-docfilessubdirs Recursively copy doc-file subdirectories-splitindex Split index into one file per letter-windowtitle Browser window title forthe documenation-doctitle Include title forthe overview page-header Include header text foreach page-footer Include footer text foreach page-bottom Include bottom text foreach page-link Create links to javadoc output at

-linkoffline Link to docs at using package list at

-excludedocfilessubdir :.. Exclude any doc-files subdirectories with given name.-group :.. Group specified packages together in overviewpage-nocomment Supress description and tags, generate only declarations.-nodeprecated Do not include @deprecated information-noqualifier ::... Exclude the list of qualifiers from the output.-nosince Do not include @since information-nodeprecatedlist Do not generate deprecated list-notree Do not generate classhierarchy-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 ::Specify single argument custom tags-taglet The fully qualified name of Taglet to register-tagletpath The path to Taglets-charset Charset for cross-platform viewing of generated documentation.-helpfile Include file that help link links to-linksource Generate source in HTML-stylesheetfile File to change style of the generated documentation-docencoding Output encoding name

C:\java>下面请看用javadoc生成的文档(请点击本页上面的观看演示链接)

生成文档:

C:\java>javadoc JavadocDemo.java

Loading source file JavadocDemo.java...

Constructing Javadoc information...

Standard Doclet version1.4.2_03

Generating constant-values.html...

Building treeforall the packages and classes...

Building indexforall the packages and classes...

Generating overview-tree.html...

Generating index-all.html...

Generating deprecated-list.html...

Building indexforall 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...

Generatingpackage-list...

Generating help-doc.html...

Generating stylesheet.css...1warning

C:\java>附源文件:import java.applet.*;import java.awt.*;import java.awt.event.*;/***JavadocDemo.java,一个显示JavaDoc注释的Applet

*

注意这只是HelloApplet的一个带注释的版本

*@seejava.applet.Applet

*@seejavax.swing.Japplet*/

public class JavadocDemo extendsApplet{/**init()是一个Applet方法,由浏览器调用进行初始化

* 只调用一次

*@return无*/

public voidinit(){//创建并添加一个按钮//其它什么也不做

Button b;

b=new Button("Hello");

add(b);

show();

}/**paint() 是一个AWT组件方法,在组件要绘制时调用,只

* 是在Applet的窗口中画带色的方框。

* 参数 g一个java.awt.Graphics

* 用在所有绘制方法中*/

public voidpaint(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中被归入不推荐使用

*@since1.0

*deprecated换用setVisible(true)*/

public voidshow(){//由于覆盖了show(),此applet 不能显示

}/**Applet必须有一个公共的无参数构造方法

*@throwsjava.lang.IllegalArgumentException*/

publicJavadocDemo(){if(new java.util.Date().getDay()==0){throw new IllegalArgumentException("Never on a Sunday");

}

}

}

java doc说明书_JAVADOC 常见使用方法 帮助文档相关推荐

  1. java 设置pdf 编码格式_Java如何设置PDF文档背景色详解

    前言 一般生成的PDF文档默认的文档底色为白色,我们可以通过一定方法来更改文档的背景色,以达到文档美化以及保护双眼的作用. 以下内容提供了Java编程来设置PDF背景色的方法.包括: 设置纯色背景 设 ...

  2. 使用Lucene对doc、docx、pdf、txt文档进行全文检索功能的实现

    转载请注明出处:http://blog.csdn.net/dongdong9223/article/details/76273859 本文出自[我是干勾鱼的博客] 这里讲一下使用Lucene对doc. ...

  3. java word 颜色设置_如何为Word文档在Java中的背景颜色

    展开全部 用第三方吧,比较方便,参考下Free Spire.Doc for Java的方法,这个是免费版,直接用可以了.62616964757a686964616fe58685e5aeb9313334 ...

  4. 开源文档系统php,推荐几种常见的PHP开源文档管理系统

    PHP语言研究是一种基于嵌入式系统的开放源码语言,没有几个基于PHP的开放源码文档管理系统,今天爱站技术频道小编向您推荐几种常见的PHP开源文档管理系统,希望对你学习有帮助! 简单的试用心得如下: 安 ...

  5. python oop 继承_oop-在Python中继承方法的文档字符串

    oop-在Python中继承方法的文档字符串 我有一个带有文档字符串的OO层次结构,它需要与代码本身一样多的维护. 例如., class Swallow(object): def airspeed(s ...

  6. Java生鲜电商平台-技术方案与文档下载

    Java生鲜电商平台-技术方案与文档下载 说明:任何一个好的项目,都应该有好的文档与设计方案,包括需求文档,概要设计,详细设计,测试用例,验收报告等等,类似下面这个图: 有以下几个管理域: 1. 开发 ...

  7. idea中类和方法创建文档注释

    一.给类创建文档注释 第一步 打开idea ==> 点击file ==> 选择Settings (也可以用快捷键 Ctrl + Alt + S) 第二步 点击Editor ==> F ...

  8. java加密解密 pdf_Java 加密和解密PDF文档

    前言 在日常办公时,为了保护文档不被他人篡改,我们可为文档设置打开口令,即加密.同时,因需要我们也可对加密文档进行解密,以便能够查看和编辑文档.本文将通过Java程序来演示如何对PDF文档进行加密和解 ...

  9. android在线预览excel文件格式,Android打开doc、xlsx、ppt等office文档解决方案

    原标题:Android打开doc.xlsx.ppt等office文档解决方案 1.Android端有什么控件可以直接显示office文档吗? 很抱歉没有,对于ios而言想要显示office文档,直接调 ...

最新文章

  1. liunx 上传 代码到github
  2. 一图简述大数据技术生态圈
  3. 安装 Oracle Database PSU 10.2.0.4.2 步骤
  4. 《c语言从入门到精通》看书笔记——第15章 存储管理
  5. 回顾build 2016:你好,这是微软迄今最好的Windows开发平台
  6. SpringBoot使用Jsp
  7. 制作自己的特色PE----Mr.Zhang
  8. 【CDH】ClouderaManager集群报警,堆转储目录/tmp 或日志目录/var/log 可用空间小于 5.0 吉字节
  9. Windows 10 IoT Serials 11 – 如何设置微软认知服务中EndPoint
  10. 详细讲解怎样做数据仓库需求分析
  11. 一文了解数据库索引:哈希、B-Tree 与 LSM
  12. 如何用UE4制作2D游戏文档(四)——NPC篇
  13. html 自动填充 颜色,excel如何设置输入数字后单元格自动填充颜色
  14. Revit模型轻量化方法
  15. ae字体预设下载_AE超强文字预设包(附插件和教程)Videohive 2D Text Preset Pack for Animation Composer Plug-in...
  16. android 重启 logo,MSM8909+Android5.1.1开机logo对应的splash.img生成
  17. ftp常见报错之Use PORT or PASV first解决思路和方法
  18. 【毕业设计】基于SSM实现酒店管理系统(论文+源码+ppt+视频)
  19. win10 管理员权限运行
  20. 自动转义json的两种方法

热门文章

  1. 用Unity3D实现简单的牧师与魔鬼游戏
  2. 热部署在java中的包名_09-springboot工程中的热部署实现。
  3. key位置 win10生成的ssh_Windows 10:如何在OpenSSH中生成SSH密钥
  4. 2015/Province_C_C++_C/8/饮料换购
  5. 征战蓝桥 —— 2014年第五届 —— C/C++A组第1题——猜年龄
  6. android 判断是否有网络连接,判断网络连接类型
  7. 【Linux】一步一步学Linux——bg命令(131)
  8. 文本相似度计算python lda_如何识别“答非所问”?使用gensim进行文本相似度计算...
  9. java密钥库文件存在但为空_java安全套接层SSL示例
  10. 每天一道LeetCode-----重新实现next_permutation