【发布时间】:2013-03-09 08:18:52
【问题描述】:
如何在 Java 中添加方法描述?我使用 NetBeans IDE。
【问题讨论】:
如何在 Java 中添加方法描述?我使用 NetBeans IDE。
【问题讨论】:
使用 javadoc cmets - /** 这是注释 */
查看此链接以获取详细文档http://en.wikipedia.org/wiki/Javadoc
【讨论】:
在你的方法上方写评论应该做你想做的事 示例:
/**
This method does some serious stuff
*/
public int getN()
{
return n;
}
如果您使用 javadocs,它应该是方法的描述。
【讨论】:
都在这里: http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/index.html.
我添加这句话是因为我上面的答案对于 SO 来说太短了。 :-)
【讨论】:
您可以通过 /** cmets */使用 javadocs
基本上你可以有一个方法
/**
The Desciption of the method to explain what the method does
@param the parameters used by the method
@return the value returned by the method
@throws what kind of exception does this method throw
*/
您可以使用此链接获取更多帮助http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#descriptions
【讨论】:
我想 IDE 正在寻找源文件中的 javadoc 定义。因此,您需要将源附加到项目中使用的库中。
【讨论】:
@Description("method name")
methodName<String> getset(){...}
@Description("class name")
class ClassName{..}
【讨论】: