Javadoc 结束标记

2022-09-04 19:50:45

阅读Oracle的Javadoc文档,我注意到作者没有关闭标签。<p>

/**
 * The method used for creating the tree. Any structural 
 * modifications to the display of the Jtree should be done 
 * by overriding this method.
 * <p>
 * This method adds an anonymous TreeSelectionListener to 
 * the returned JTree.  Upon receiving TreeSelectionEvents, 
 * this listener calls refresh with the selected node as a 
 * parameter. 
 */
public JTree makeTree(AreaInfo ai){
}

文档指出:

如果文档注释中有多个段落,请使用段落标记分隔段落,如下所示。<p>

在Eclipse中,Javadoc的格式是正确的,但仅仅因为它有效,它是否意味着它是“正确的”?


答案 1

是的,这是正确的。规格引用

某些 HTML 元素类型允许作者省略结束标记(例如,P 和 LI 元素类型)


答案 2

推荐