java -/* 和/** 之间的区别

标签 java eclipse

我发现,在eclipse中,

/*
 * Hello world, this is green.
 *
 */

评论将为绿色。然而,

/**
 * Hello moon, this is blue.
 *
 */

如果我使用/**,它会变成蓝色。 所以为什么?有什么区别吗?

最佳答案

/* 开始一个常规的多行注释,/** 开始一个支持javadoc tool 的多行注释。 ,它会根据您的评论生成 HTML 文档。

这是一个例子 from the documentation :

/**
 * 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;
    }
}

The Java API specification itself是通过 javadoc 生成的 HTML 文档的示例。

关于java -/* 和/** 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23357887/

相关文章:

java - 如何修复,AL lib : (EE) alc_cleanup: 1 device not closed Java HotSpot(TM) 64-Bit Server VM warning:

java - JNI 检测到应用程序错误 : use of deleted weak global reference

java - 如何使用现有源代码集成到 Eclipse 中?

eclipse - java.lang.OutOfMemory错误: PermGen space in Eclipse Helios

eclipse - 如何在 Developer Studio 中排除构建文件?

java - 构建路径指定执行环境J2SE-1.4。 eclipse 中的错误

java - 线程 "main"java.lang.NoClassDefFoundError : org/jsoup/nodes/Element 中出现异常

java - 代理的Weblogic设置

java - 在构建针对多个实体运行的通用 Lucene 查询时如何排除或忽略字段

c - gcc 由于无法识别 __TIMESTAMP__ 和其他一些已定义的构建变量而生成编译时错误