1. 我们知道Java中有三种注释语句:
  2. 1.//用于单行注释。
  3. 2./*...*/用于多行注释,从/*开始,到*/结束,不能嵌套。
  4. 3./**...*/则是为支持jdk工具javadoc.exe而特有的注释语句。
  5. javadoc工具能从java源文件中读取第三种注释,并能识别注释中用@标识的一些特殊变量(见表),制作成Html格式的类说明文档。 javadoc不但能对一个java源文件生成注释文档,而且能对目录和包生成交叉链接的html格式的类说明文档,十分方便。
  6.  
  7. 注释中可以出现的关键字,以@开头:
  8. @author 作者名
  9. @version 版本标识
  10. @parameter 参数名及其意义
  11. @since 最早出现的JDK版本
  12. @return 返回值
  13. @throws 异常类及抛出条件
  14. @deprecated 引起不推荐使用的警告
  15. @see 交叉参考
  16.  
  17. 下面是javadoc.exe的用法
  18.  
  19. C:\java>javadoc -help
  20.  
  21. C:\java>javadoc -help
  22.  
  23. usage: javadoc [options] [packagenames] [sourcefiles] [classnames] [@files]
  24. -overview <file> Read overview documentation from HTML file
  25. -public Show only public classes and members
  26. -protected Show protected/public classes and members (default)
  27. -package Show package/protected/public classes and members
  28. -private Show all classes and members
  29. -help Display command line options and exit
  30. -doclet <class> Generate output via alternate doclet
  31. -docletpath <path> Specify where to find doclet class files
  32. -sourcepath <pathlist> Specify where to find source files
  33. -classpath <pathlist> Specify where to find user class files
  34. -exclude <pkglist> Specify a list of packages to exclude
  35. -subpackages <subpkglist> Specify subpackages to recursively load
  36. -breakiterator Compute 1st sentence with BreakIterator
  37. -bootclasspath <pathlist> Override location of class files loaded by the bootstrap class loader
  38. -source <release> Provide source compatibility with specified release
  39. -extdirs <dirlist> Override location of installed extensions
  40. -verbose Output messages about what Javadoc is doing
  41. -locale <name> Locale to be used, e.g. en_US or en_US_WIN
  42. -encoding <name> Source file encoding name
  43. -J<flag> Pass <flag> directly to the runtime system
  44.  
  45. Provided by Standard doclet:
  46. -d <directory> Destination directory for output files
  47. -use Create class and package usage pages
  48. -version Include @version paragraphs
  49. -author Include @author paragraphs
  50. -docfilessubdirs Recursively copy doc-file subdirectories
  51. -splitindex Split index into one file per letter
  52. -windowtitle <text> Browser window title for the documenation
  53. -doctitle <html-code> Include title for the overview page
  54. -header <html-code> Include header text for each page
  55. -footer <html-code> Include footer text for each page
  56. -bottom <html-code> Include bottom text for each page
  57. -link <url> Create links to javadoc output at <url>
  58. -linkoffline <url> <url2> Link to docs at <url> using package list at <url2>
  59. -excludedocfilessubdir <name1>:.. Exclude any doc-files subdirectories with given name.
  60. -group <name> <p1>:<p2>.. Group specified packages together in overviewpage
  61. -nocomment Supress description and tags, generate only declarations.
  62. -nodeprecated Do not include @deprecated information
  63. -noqualifier <name1>:<name2>:... Exclude the list of qualifiers from the output.
  64. -nosince Do not include @since information
  65. -nodeprecatedlist Do not generate deprecated list
  66. -notree Do not generate class hierarchy
  67. -noindex Do not generate index
  68. -nohelp Do not generate help link
  69. -nonavbar Do not generate navigation bar
  70. -quiet Do not display status messages to screen
  71. -serialwarn Generate warning about @serial tag
  72. -tag <name>:<locations>:<header> Specify single argument custom tags
  73. -taglet The fully qualified name of Taglet to register
  74.  
  75. -tagletpath The path to Taglets
  76. -charset <charset> Charset for cross-platform viewing of generated documentation.
  77. -helpfile <file> Include file that help link links to
  78. -linksource Generate source in HTML
  79. -stylesheetfile <path> File to change style of the generated documentation
  80. -docencoding <name> Output encoding name
  81.  
  82. C:\java>
  83. 下面请看用javadoc生成的文档(请点击本页上面的观看演示链接)
  84. 生成文档:
  85.  
  86. C:\java>javadoc JavadocDemo.java
  87. Loading source file JavadocDemo.java...
  88. Constructing Javadoc information...
  89. Standard Doclet version 1.4.2_03
  90. Generating constant-values.html...
  91. Building tree for all the packages and classes...
  92. Building index for all the packages and classes...
  93. Generating overview-tree.html...
  94. Generating index-all.html...
  95. Generating deprecated-list.html...
  96. Building index for all classes...
  97. Generating allclasses-frame.html...
  98. Generating allclasses-noframe.html...
  99. Generating index.html...
  100. Generating packages.html...
  101. Generating JavadocDemo.html...
  102. JavadocDemo.java:11: warning - Tag @see: reference not found: javax.swing.Japplet
  103. Generating serialized-form.html...
  104. Generating package-list...
  105. Generating help-doc.html...
  106. Generating stylesheet.css...
  107. 1 warning
  108.  
  109. C:\java>
  110. 附源文件:
  111. import java.applet.*;
  112. import java.awt.*;
  113. import java.awt.event.*;
  114. /**
  115. *JavadocDemo.java,一个显示JavaDoc注释的Applet
  116. *<p>注意这只是HelloApplet的一个带注释的版本
  117. *@see java.applet.Applet
  118. *@see javax.swing.Japplet
  119. */
  120.  
  121. public class JavadocDemo extends Applet{
  122.  
  123. /** init()是一个Applet方法,由浏览器调用进行初始化
  124. * 只调用一次
  125. * @return 无
  126. */
  127. public void init(){
  128. //创建并添加一个按钮
  129. //其它什么也不做
  130. Button b;
  131. b=new Button("Hello");
  132. add(b);
  133. show();
  134. }
  135.  
  136. /** paint() 是一个AWT组件方法,在组件要绘制时调用,只
  137. * 是在Applet的窗口中画带色的方框。
  138. * 参数 g一个java.awt.Graphics
  139. * 用在所有绘制方法中
  140. */
  141.  
  142. public void paint(Graphics g){
  143. int w=getSize().width,h=getSize().height;
  144. g.setColor(Color.yellow);
  145. g.fillRect(0,0,w/2,h);
  146. g.setColor(Color.green);
  147. g.fillRect(w/2,0,w,h);
  148. g.setColor(Color.black);
  149. g.drawString("Welcome to Java",50,50);
  150. }
  151.  
  152. /** show()用于使组件可见,此方法在
  153. * JDK1.1中被归入不推荐使用
  154. *@since 1.0
  155. *deprecated换用setVisible(true)
  156. */
  157.  
  158. public void show(){
  159. //由于覆盖了show(),此applet 不能显示
  160. }
  161.  
  162. /** Applet必须有一个公共的无参数构造方法
  163. *@throws java.lang.IllegalArgumentException
  164. */
  165.  
  166. public JavadocDemo(){
  167. if(new java.util.Date().getDay()==0){
  168. throw new IllegalArgumentException("Never on a Sunday");
  169. }
  170. }
  171. }

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. div边框阴影的实现【转载】

    box-shadow:阴影水平偏移值(可取正负值): 阴影垂直偏移值(可取正负值):阴影模糊值:阴影颜色: Firefox支持Box Shadow(阴影):-moz-box-shadow:2px 2p ...

  2. CLR via C#字符串和文本处理

    一.字符   在.NET Framewole中,字符总是表示成16位Unicode代码值,这简化了国际化应用程序的开发.   每个字符都表示成System.Char结构(一个值类型) 的一个实例.Sy ...

  3. d039: 点的位置

    内容: 已知一平面直角坐标系中正方形的左上(-2,2)和右下(2,-2)的顶点坐标,,当给一个点的坐标,判断点和正方形的关系,在正方形内(含边上)输出True ,否则输出 False 输入说明: 一行 ...

  4. Android Studio下运行UiAutomator

    之前学习UiAutomator均是在eclipse下,因学习Android开发接触AS越来越频繁,于是想知道AS下如何建立UiAutomator项目.网上的资料多很凌乱,查了很多资料,实践后发现,只要 ...

  5. 存储过程中update,然后用sql%判断update是否成功的存储过程

    --更新用户状态 PROCEDURE P_UPDATE_USER_STATUS ( v_SrcID IN NUMERIC, v_DstID IN NUMERIC, v_DstType IN NUMER ...

  6. Collection Views and Building Custom Layouts-备

    UICollectionView的结构回顾 首先回顾一下Collection View的构成,我们能看到的有三个部分: Cells Supplementary Views 追加视图 (类似Header ...

  7. 复杂事件处理引擎—Esper参考(事件部分)

    声明:Esper官方未提供中文文档,以后更新的大部分内容,均来自官方文档.本人英语小白一枚,翻译内容仅供参考.有些翻译确实不忍直视,君可略过. (有人可能会说,翻译的不好不如不翻,可能会误人子弟:不过 ...

  8. RAILS局部视图操作样例

    按如下书操作的,讲得很易懂.. <html> <head> <title>SampleApp</title> <%= stylesheet_lin ...

  9. iOS 9之应用内搜索(CoreSpotlight)API

    金田(github 示例源码) 前言 在iOS9之前我们只能使用Spotlight来搜索应用名称来打开指定App,而其他的内容都是提供给系统使用(信息,联系人,邮件等).在iOS9以后Apple允许开 ...

  10. 浅谈zygote服务中的设计思路

    zygote服务是Android启动和服务APK的核心服务,每个APK都是通过zygote启动,今日阅读它的源码学习到一个不错的设计思路. 首先看看一个APK通过zygote的启动流程: 按照一般的设 ...