注解@param
是如何工作的?
如果我有这样的事情:
/*
*@param testNumber;
*/
int testNumber = 5;
if (testNumber < 6) {
//Something
}
@param
将如何影响 testNumber?它甚至会影响 testNumber 吗?
谢谢。如果我用错了,请告诉我。
最佳答案
@param
是 javadoc 用来生成文档的特殊格式注释。它用于表示方法可以接收的参数(或多个参数)的描述。还有@return
和@see
分别用来描述返回值和相关信息:
http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#format
除其他外,还有:
/**
* Returns an Image object that can then be painted on the screen.
* The url argument must specify an absolute {@link URL}. The name
* argument is a specifier that is relative to the url argument.
* <p>
* This method always returns immediately, whether or not the
* image exists. When this applet attempts to draw the image on
* the screen, the data will be loaded. The graphics primitives
* that draw the image will incrementally paint on the screen.
*
* @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) {
关于java - @param 究竟是如何工作的 - Java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16138217/