简体   繁体   English

寻找具有Javadoc注释的Java代码的好例子

[英]Looking for good example of Java code that has Javadoc comments

I've been running Checkstyle on some code and looking for a good example to get to grips with how to add comments for specific purposes. 我一直在某些代码上运行Checkstyle,并寻找一个好的示例来掌握如何为特定目的添加注释。

For example Checkstyle says I should add comments for constants/class variables. 例如Checkstyle说我应该为常量/类变量添加注释。 Yet nowhere in the official docs Oracle host, can I find an example of this. 但是在官方文档Oracle主机中,没有地方可以找到这样的示例。

I was looking in various places, but couldn't find a concise example... 1 2 3 4 5 我到处都是,但是找不到一个简单的例子... 1 2 3 4 5

I figured if I could get my hands on the source code for the Java Calendar class, it would be a good example. 我认为如果可以接触Java Calendar类的源代码,那将是一个很好的例子。 You can see all sorts of constants in the API docs of that class. 您可以在该类的API文档中查看各种常量。

See here . 这里

How can I either: 我怎么可以:

1) Get my hands on the source for Calendar? 1)掌握日历的来源吗?

2) Find an example of how you'd document code like this in Javadoc (Checkstyle flags it needs it): 2)找到一个示例,说明如何在Javadoc中记录这样的代码(Checkstyle标记需要它):

private static final int NO_OF_RECORDS = 10;

On the Java 6 download page , under the "additional resources" section, you can download the source code for the whole JDK. Java 6下载页面的“其他资源”部分下,您可以下载整个JDK的源代码。

Additionally, most IDEs automatically index the source code for Java's library classes so you can open those classes transparently. 此外,大多数IDE会自动为Java的库类的源代码建立索引,以便您可以透明地打开这些类。

Oracle当前的Java 6源下载链接到http://download.java.net/jdk6/source/ ,其中应包含整个Java库源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM