Java /*和之间的差异/**

Java /*和之间的差异/**,java,eclipse,Java,Eclipse,我发现,在eclipse中 /* * Hello world, this is green. * */ 评论将是绿色的。但是, /** * Hello moon, this is blue. * */ 如果我使用/**,它将变为蓝色。 那为什么呢?有什么区别吗?以/*开头的注释是正常的代码注释。它们通常用于描述逻辑的代码行顶部 以/**开头的注释用于javadocs。这些用于方法和类的顶部当/*启动常规多行注释时,/**启动支持的多行注释,该注释将根据您的注释生成HTML文档 这

我发现,在eclipse中

/*
 * Hello world, this is green.
 *
 */
评论将是绿色的。但是,

/**
 * Hello moon, this is blue.
 *
 */
如果我使用/**,它将变为蓝色。
那为什么呢?有什么区别吗?

/*
开头的注释是正常的代码注释。它们通常用于描述逻辑的代码行顶部


/**
开头的注释用于javadocs。这些用于方法和类的顶部

/*
启动常规多行注释时,
/**
启动支持的多行注释,该注释将根据您的注释生成HTML文档

这是一个例子:

/**
*返回可以在屏幕上绘制的图像对象。
*url参数必须指定绝对值{@link url}。名字
*参数是相对于url参数的说明符。
*
*此方法总是立即返回,无论
*图像存在。当此小程序尝试在其上绘制图像时
*在屏幕上,将加载数据。图形原语
*绘制图像的步骤将在屏幕上递增绘制。
*
*@param url给出图像基本位置的绝对url
*@param name图像相对于url参数的位置
*@返回指定URL处的图像
*@见图片
*/
公共图像getImage(URL、字符串名称){
试一试{
返回getImage(新的URL(URL,name));
}捕获(格式错误){
返回null;
}
}

是通过
javadoc

/*text*/
生成的HTML文档示例:编译器忽略从
/*
*/
的所有内容

/**文档*/

这表示文档注释(简称文档注释)。编译器忽略此类注释,就像它忽略使用/*和*/的注释一样。JDK javadoc工具在准备自动生成的文档时使用文档注释。有关javadoc的更多信息,请参阅Java工具

/*只是一个多行注释

/**是针对Javadoc的,它允许您使文档更易于用户阅读

看一看


虽然
/**
注释启动程序是针对javadoc的,但从编译器的角度来看,它们实际上是相同的。评论就是评论就是评论。这里的重要部分是
/**
/*
,添加了一个额外的星号。

第一个是多行注释,第二个是Javadoc,正如sanbhat所说,第二个是如何编写Javadoc注释。为了对所有神圣事物的爱,请学会如何使用它,并慷慨地使用它!不使用Javadoc是无知的noob的标志。
/**
 * 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) {
    try {
        return getImage(new URL(url, name));
    } catch (MalformedURLException e) {
        return null;
    }
}