假设您的课程有2种方法:
contains() and
containsSame()
它们之间的区别很细微,您想在Javadoc中提及它
在Javadoc中,如何通过名称引用同一类中的方法?
使用@link
内联标签,并使用前导引用该方法#
。
/**
* ...
* This method is similar to {@link #contains()}, with the following differences:
* ...
*/
public boolean containsSame();
/**
* This method does ...
*/
public boolean contains();
此示例仅在实际上存在一个contains()
没有参数的方法(实际上似乎没有那么有用)的情况下才有效。如果只有contains
带有参数的方法,则可以在括号中输入参数类型:
/**
* ...
* This method is similar to {@link #contains(Element)}, with the following differences:
* ...
*/
public boolean containsSame(Element e);
/**
* This method does ...
*/
public boolean contains(Element e);
或者,您可以完全省略括号:
/**
* ...
* This method is similar to {@link #contains}, with the following differences:
* ...
*/
public boolean containsSame(Element e);
/**
* This method does ...
*/
public boolean contains(Element e);
如果您有几种已命名的方法contains
(具有不同的参数列表),则此版本无法决定要使用哪种方法(链接将跳至其中的任何一种,希望它们在一起并做相似的事情)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句