我们知道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 |
|
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");
}
}
}
posted @
2007-12-14 16:31 第一控制.NET 阅读(172) |
评论 (0) |
编辑
当前几乎所有的大型电脑厂商都在采取各种措施来制造更为环保友好型的电脑产品,华硕电脑就是其中之一。
在上个世纪的1976年,Steve Wozniak 和Steve Jobs联手开发出了世界上第一代苹果电脑,而当时的第一代苹果电脑居然是将集成电路盛放在一个简单的木头盒子里的。
但后来的苹果公司以及其他电脑制造商,在为高级PC选择外壳时换成了金属和塑料包装,华硕电脑却另辟蹊径,使用另外的一种环保PC包装材料——竹子来用作电脑的外壳。
据悉,华硕在其“Eco Book”笔记本产品外壳采用了精致打磨的竹子材质,键盘边缘也都用竹子制成,并具备能够自行更换磨损的腕垫,降低了报废后对环境造成的污染。
目前该产品仍然处于原型试验阶段,工程人员正在测试竹子是否适应于笔记本产品,因为笔记本电脑微处理器和显示器产生的热会对竹子形成潜在威胁。
华硕电脑的一位负责人表示,最初华硕公司推出了皮革外壳的电脑产品,而且在美国市场很受欢迎。此后,华硕开始尝试使用其他类型的一些材料做电脑外壳,直至选择了今天的绿色产品——竹子。
当前几乎所有的大型电脑厂商都在采取各种措施来制造更为环保友好型的电脑产品,华硕电脑就是其中之一。
从 事PC市场研究的咨询公司Endpoint Technologies Associates总裁Roger L. Kay称,“我认为电脑不会重新回到木制外壳的时代,但关注生态是电脑制造行业的一个趋势,而且人们对此关注程度不断增长。但我的总体感觉是,这里作秀的 成分要比所宣扬的可持续发展等实质性的成分更大一些。”
posted @
2007-12-14 13:03 第一控制.NET 阅读(204) |
评论 (5) |
编辑
感谢匿名人士的投递
据悉,近期沸沸扬扬的珊瑚虫案将于12月19日在深圳南山区法院开庭审理。由于深圳南山区法院是腾讯公司总部所在地,上海律师游云庭表示,审判结果可能不会乐观。2007年8月,腾讯公司动用深圳警方力量,将珊瑚虫的陈寿福从北京的家中拘捕回深圳。腾讯公司指控陈寿福通过捆绑制作珊瑚虫QQ非法获利,如果这一罪名 成立,陈寿福可能会被判处1到7年有期徒刑。事发后,虽有业内多位著名人士替陈寿福向腾讯公司求情,但是腾讯公司均以“不知情”推托。《新世纪周刊》和 《华尔街日报》等多家媒体报道了这一事件。
2007年12月,陈寿福的律师接到通知,本案将于12月19日在深圳南山区法院开庭审理。由于深圳南山区法院是腾讯公司总部所在地,上海律师游云庭表示,审判结果可能不会乐观。但是游律师仍然坚持陈寿福只是民事侵权而非刑事犯罪的观点。
游律师发表文章指出:“虽然在民事法律上,修改他人作品属于侵权行为,但根据前文中引述的我国刑法第217条只规定了复制作品进行营利达到一定标准的犯罪构成要件,并没有规定修改他人作品的行为的情况,而在本案中,主要的涉案侵权行为恰恰为修改他人作品的行为。所以,Soff的行为不符合侵犯著作权罪的构成要件,不构成此罪。”
posted @
2007-12-14 13:01 第一控制.NET 阅读(186) |
评论 (3) |
编辑