2012-10-08 52 views
0

我喜歡在我的基於Java的應用程序(源文件)中添加評論(類,方法級別)。我想知道是否有我使用的Eclipse如何添加評論到我的Java應用程序(標準方式)

添加註釋,也分享一些工具,可以讓我的應用程序的一些文檔,如果源傳遞給該工具有意見

任何標準的方法

在此先感謝:)

回答

12

您可以使用Javadoc。它使用語法來記錄註釋,然後處理源代碼以創建文檔文件。它是Java SDK的一部分,所以如果你使用Java編程,你可能已經安裝了它。

的Javadoc看起來是這樣的:

/** 
* This is a Javadoc example. It explains the working of Javadoc comments. 
* 
* @param String text 
* The above line is used to document what the parameters 
* that are passed to the method do. 
* Each parameter gets its own @param block. 
* 
* @return void 
* This explains what the output/result of the method is. In this case, it's void. 
*/ 

併爲代碼不需要評論將其加工成的Javadoc你當然可以用 //commentcommentcomment文本或 /* comment comment comment comment comment */的單行註釋掉註釋掉多行文字。

+3

就像我說的那樣,Javadoc小應用程序就是這樣。我看到你正在使用Eclipse。按照此頁面上的instructon http://www.eclipse-blog.org/eclipse-ide/generating-javadoc-in-eclipse-ide.html –

相關問題