我在工作中一直在使用 .jd 文件,在本地计算机中构建它以将其转换为 html...
但是,我仍然对 .jd 文件的用途感到困惑?我做了一些研究,定义是:“Javadoc 是一个从代码中的 Javadoc 注释生成 html 文档(类似于 java.sun.com 的引用页)的工具。”
当我查看 .jd 文件代码时,它们看起来非常像 html。他们有<p>
标签和 <li>
标签。程序员写javadoc代码吗?或者Javadoc是一个从Java代码中提取注释的工具(这对我来说很模糊,一个名为Javadoc的生成.jd文件的软件工具?)?
有人可以帮我理解吗?由于我没有直接生成 .jd 文件,因此很难理解它的用途以及它到底是什么......
非常感谢!
最佳答案
JavaDoc 由开发人员编写,并在其源代码中嵌入注释。
例如:
/**
* 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;
}
}
此示例记录了一个名为 getImage 的方法。
JavaDoc 很棒,因为它是开发人员可以在代码旁边编写代码的文档,并且在运行生成器后,他们拥有其他人可以轻松阅读的良好技术文档。
您在 .jd 文件中看到 html 的原因是由于格式原因,一些 html 可以嵌入到 JavaDoc 中(请参阅示例)
关于java - .jd 文件到底有什么用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34141780/