您好,欢迎访问一九零五行业门户网

Java高级教程:javadoc输出什么

javadoc工具将你java程序的源代码作为输入,输出一些包含你程序注释的html文件。
每一个类的信息将在独自的html文件里。javadoc也可以输出继承的树形结构和索引。
由于javadoc的实现不同,工作也可能不同,你需要检查你的java开发系统的版本等细节,选择合适的javadoc版本。
实例
下面是一个使用说明注释的简单实例。注意每一个注释都在它描述的项目的前面。
在经过javadoc处理之后,squarenum类的注释将在squarenum.html中找到。
import java.io.*; /** * this class demonstrates documentation comments. * @author ayan amhed * @version 1.2 */ public class squarenum { /** * this method returns the square of num. * this is a multiline description. you can use * as many lines as you like. * @param num the value to be squared. * @return num squared. */ public double square(double num) { return num * num; } /** * this method inputs a number from the user. * @return the value input as a double. * @exception ioexception on input error. * @see ioexception */ public double getnumber() throws ioexception { inputstreamreader isr = new inputstreamreader(system.in); bufferedreader indata = new bufferedreader(isr); string str; str = indata.readline(); return (new double(str)).doublevalue(); } /** * this method demonstrates square(). * @param args unused. * @return nothing. * @exception ioexception on input error. * @see ioexception */ public static void main(string args[]) throws ioexception { squarenum ob = new squarenum(); double val; system.out.println("enter value to be squared: "); val = ob.getnumber(); val = ob.square(val); system.out.println("squared value is " + val); } } 如下,使用javadoc工具处理squarenum.java文件: $ javadoc squarenum.java loading source file squarenum.java... constructing javadoc information... standard doclet version 1.5.0_13 building tree for all the packages and classes... generating squarenum.html... squarenum.java:39: warning - @return tag cannot be used\ in method with void return type. generating package-frame.html... generating package-summary.html... generating package-tree.html... generating constant-values.html... 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 help-doc.html... generating stylesheet.css... 1 warning $
以上就是java高级教程:javadoc输出什么的内容。
其它类似信息

推荐信息