2015-10-17 85 views
-6

我对java很陌生,对于我的任务之一正在研究如何为每个类中的方法添加信息。我正在使用IntelliJ Idea Editor。在Javadoc中编辑字段IntelliJ

+0

你的问题到底是什么?要添加javadoc,那么您可以按照文档所述编写它:http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/index.html –

回答

0

以下是使用JavaDoc的示例。

import java.io.*; 

/** 
* <h1>Add Two Numbers!</h1> 
* The AddNum program implements an application that 
* simply adds two given integer numbers and Prints 
* the output on the screen. 
* <p> 
* <b>Note:</b> Giving proper comments in your program makes it more 
* user friendly and it is assumed as a high quality code. 
* 
* @author Zara Ali 
* @version 1.0 
* @since 2014-03-31 
*/ 
public class AddNum { 
    /** 
    * This method is used to add two integers. This is 
    * a the simplest form of a class method, just to 
    * show the usage of various javadoc Tags. 
    * @param numA This is the first paramter to addNum method 
    * @param numB This is the second parameter to addNum method 
    * @return int This returns sum of numA and numB. 
    */ 
    public int addNum(int numA, int numB) { 
     return numA + numB; 
    } 

    /** 
    * This is the main method which makes use of addNum method. 
    * @param args Unused. 
    * @return Nothing. 
    * @exception IOException On input error. 
    * @see IOException 
    */ 
    public static void main(String args[]) throws IOException 
    { 

     AddNum obj = new AddNum(); 
     int sum = obj.addNum(10, 20); 

     System.out.println("Sum of 10 and 20 is :" + sum); 
    } 
} 

增加了对文档的所有信息的IntelliJ IDEA后工具 - >生成Javadoc ...然后指定输出目录并单击OK

这里有关如何使用的更多详细信息生成JavaDoc对话框 in IDEA - https://www.jetbrains.com/idea/help/generate-javadoc-dialog.html

也看看甲骨文的风格指南如何编写文档注释的Javadoc工具 - http://www.oracle.com/technetwork/articles/java/index-137868.html

祝你好运!

+0

非常感谢! :) –