31

在 Java 方法之前,我们有类似的东西:

/**
 * Takes a number and returns its square root.
 * @param x The value to square.
 * @return The square root of the given number.
 */
public float getSqrt(float x) {
...
}

这是否有名称(如 Python 中的文档字符串)?

4

2 回答 2

30

Actually, they are called document comments and javadoc is a tool to generate those comments into HTML.

You can find the structure of the Javadoc comment in Wikipedia (for example).

于 2010-09-16T16:18:46.383 回答
6

是的,它被称为javadoc

于 2010-09-16T15:35:08.197 回答