views:

74

answers:

2

Before Java methods we have something like:

/**
 * 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) {
...
}

Does this have a name (like docstrings in Python)?

+5  A: 

Yup, it's called javadoc.

Riduidel
No, javadoc is the tool that processes them. They are called doc comments.
seanizer
@seanizer that's obviously why pages generated using the javadoc tool are usually called "javadoc" and even why Eclipse and other IDEs have specific views called "Javadoc" used to display only those "doc comments".
Riduidel
@riduidel hey, I call em JavaDocs myself, but it's not the official name. And the official document behind the link *you* supplied has the title "How to Write Doc Comments for the Javadoc Tool", not "How to Write Javadoc Comments"
seanizer
@seanizer Well, to a certain extend, you are write, as it is the Sun name. However, the usage name for them is javadoc for the whole. Like we call Java the assembly of the Java Virtual Machine, the Java language, and the Java APIs. But that's only my point of view (and you are totally right to defend that opinion).
Riduidel
No, I agree with you. I use both the terms (Java and javadoc) the way you do. I was just nitpicking that the official name is different. :-)
seanizer
+4  A: 

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

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

The Elite Gentleman