【发布时间】:2015-08-02 14:28:09
【问题描述】:
文档有时会降低代码的可读性。
代替
/**
* The X axis.
*/
int x;
/**
* The Y axis.
*/
int y;
/**
* The Z axis.
*/
int z;
我宁愿拥有
int x; /** The X axis */
int y; /** The Y axis */
int z; /** The Z axis */
在 Java 中有没有办法让 cmets 在 e 的右侧。 G。变量声明?我已经通过使用“
【问题讨论】:
-
你可以使用
// my comments和/* my comments */ -
@ankur-singhal:这些与文档无关。
-
对于文档 cmets,我们应该避免使用
//comment。您也可以关注download.java.net/jdk7u2/docs/technotes/tools/solaris/… 和oracle.com/technetwork/articles/java/index-137868.html。 -
回答这个问题:javadoc-comment 必须始终位于它记录的代码之前。所以不,你不能在右边写评论。你可以写在左边:
/** The X axis */ int x;
标签: java documentation comments