0

如果@param 注释不适合一行,JavaDoc 是否会将换行符中的单词识别为有关方法参数的信息?

4

2 回答 2

4

您可以在新行上继续描述。例如:

/*
 * . . .
 * @param p
 *            text describing the parameter can overflow the
 *            line. It doesn't even have to start on the line.
 *            Indenting is not necessary, but it's nice for
 *            readability. The asterisk at the start of each
 *            line does not appear in the docs. The description
 *            ends at the start of the next "@..." tag or the
 *            end of the comment block.
 */
于 2013-01-03T18:57:16.923 回答
1

您可以为从 Oracle 的“如何编写 javadoc”@param中获取和修改的示例做多于一行的信息:

/**
 * Registers the text to display in a tool tip.   The text 
 * displays when the cursor lingers over the component.
 *
 * @param text  the string to display.  If the text is null, 
 *              the tool tip is turned off for this component.

您还可以做多个@param输入:

/**
 * ...
 * @param  url  an absolute URL giving the base location of the image
 * @param  name the location of the image, relative to the url argument
 * @return      the image at the specified URL
 * @see         Image
 */
 public Image getImage(URL url, String name) {
于 2013-01-03T19:00:44.427 回答