gpt4 book ai didi

java - .jd 文件到底有什么用?

转载 作者:太空宇宙 更新时间:2023-11-04 16:12:37 24 4
gpt4 key购买 nike

我在工作中一直使用 .jd 文件,在我的本地计算机上构建它以将其转换为 html...

但是,我仍然对 .jd 文件的用途感到困惑?我做了一些研究,其定义是:“Javadoc 是一种从代码中的 Javadoc 注释生成 html 文档(类似于 java.sun.com 的引用页面)的工具。”

当我查看 .jd 文件代码时,它们看起来非常像 html。他们有 <p>标签和 <li>标签。程序员编写 javadoc 代码吗?还是Javadoc是一个工具(我很模糊,一个叫Javadoc的生成.jd文件的软件工具?)从Java代码中提取注释?

谁能帮我理解一下?由于我不直接处理生成 .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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com