亚洲欧洲国产欧美一区精品,激情五月亚洲色五月,最新精品国偷自产在线婷婷,欧美婷婷丁香五月天社区

      考試首頁 | 考試用書 | 培訓(xùn)課程 | 模擬考場 | 考試論壇  
      全國  |             |          |          |          |          |         
        當(dāng)前位置:計(jì)算機(jī)等級(jí) > 二級(jí)考試 > Java語言程序設(shè)計(jì) > 考試輔導(dǎo) > 文章內(nèi)容
        

      全國計(jì)算機(jī)等級(jí)考試Java語言程序設(shè)計(jì)輔導(dǎo)(111)

      中華IT學(xué)院   【 】  [ 2016年3月24日 ]

      javadoc工具將你Java程序的源代碼作為輸入,輸出一些包含你程序注釋的HTML文件。

      每一個(gè)類的信息將在獨(dú)自的HTML文件里。javadoc也可以輸出繼承的樹形結(jié)構(gòu)和索引。

      由于javadoc的實(shí)現(xiàn)不同,工作也可能不同,你需要檢查你的Java開發(fā)系統(tǒng)的版本等細(xì)節(jié),選擇合適的Javadoc版本。

      實(shí)例

      下面是一個(gè)使用說明注釋的簡單實(shí)例。注意每一個(gè)注釋都在它描述的項(xiàng)目的前面。

      在經(jīng)過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
      $
      分享到:
      本文糾錯(cuò)】【告訴好友】【打印此文】【返回頂部
      將考試網(wǎng)添加到收藏夾 | 每次上網(wǎng)自動(dòng)訪問考試網(wǎng) | 復(fù)制本頁地址,傳給QQ/MSN上的好友 | 申請(qǐng)鏈接 | 意見留言 TOP
      關(guān)于本站  網(wǎng)站聲明  廣告服務(wù)  聯(lián)系方式  站內(nèi)導(dǎo)航  考試論壇
      Copyright © 2007-2013 中華考試網(wǎng)(Examw.com) All Rights Reserved