【问题标题】:How to add description to method or class如何向方法或类添加描述
【发布时间】:2013-03-09 08:18:52
【问题描述】:

如何在 Java 中添加方法描述?我使用 NetBeans IDE。

【问题讨论】:

    标签: java netbeans javadoc


    【解决方案1】:

    使用 javadoc cmets - /** 这是注释 */

    查看此链接以获取详细文档http://en.wikipedia.org/wiki/Javadoc

    【讨论】:

      【解决方案2】:

      【讨论】:

        【解决方案3】:

        在你的方法上方写评论应该做你想做的事 示例:

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

        如果您使用 javadocs,它应该是方法的描述。

        【讨论】:

          【解决方案4】:

          都在这里: http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/index.html.

          我添加这句话是因为我上面的答案对于 SO 来说太短了。 :-)

          【讨论】:

            【解决方案5】:

            您可以通过 /** 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

            【讨论】:

              【解决方案6】:

              我想 IDE 正在寻找源文件中的 javadoc 定义。因此,您需要将源附加到项目中使用的库中。

              【讨论】:

                【解决方案7】:
                @Description("method name")
                methodName<String> getset(){...}
                
                @Description("class name")
                class ClassName{..}
                

                【讨论】:

                  猜你喜欢
                  • 1970-01-01
                  • 2016-04-14
                  • 2021-10-06
                  • 1970-01-01
                  • 1970-01-01
                  • 2022-11-16
                  • 2012-01-31
                  • 1970-01-01
                  • 1970-01-01
                  相关资源
                  最近更新 更多