如何将描述添加到方法或类

问题描述 投票:0回答:5
如何在Java中添加方法描述?我使用Netbeans IDE。

JavaDoc example

您可以使用 /**注释* /
java netbeans javadoc
5个回答
36
投票
对于一种方法,基本上您可以拥有

/** 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 */

您可以将此链接用于futher帮助

Http://www.oracle.com/technetwork/java/java/javase/documentation/index-137868.html#descriptions

    

使用Javadoc评论 - /**这是评论* /

检查此链接以获取详细文档

20
投票

在您的方法上方的写入评论应该做您想做的。 示例:

/** This method does some serious stuff */ public int getN() { return n; }

6
投票
如果您使用Javadocs,则应该是方法的描述。

请参阅
Guide

并查看一些标准Java类的

source代码。

3
投票
这一切都在这里:

Http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/index.html,。 我添加了这句话,因为我上面的答案太短了。 :-) 我假设IDE正在寻找源文件中的Javadoc定义。因此,您需要将源附加到项目中使用的库。


2
投票

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.