如何在java中解释/***/?

发布于 2024-12-06 16:23:50 字数 1431 浏览 0 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

柳若烟 2024-12-13 16:23:50

将其视为评论,因为显然没有任何文档可以传达给任何人。

编辑

例如,Eclipse 会将 /***/ 视为文档。从 这个解释 Java 语法的网站获取提示,/**"documentation"*/ 还正式指定文档位于 /***/ 之间,即使其内容长度为零。

实际上,我会说:将其视为评论。正式地,将其视为文档。选择一个。

Treat it as a comment since obviously there is no documentation to be communicated to anyone.

Edit:

Eclipse, for example, will treat /***/ as documentation. Taking cue from this site where Java grammar is explained, /**"documentation"*/ also formally specifies that documentation is between /** and */, even when length of its content is zero.

Practically, I'd say: treat it as comments. Formally, treat it as documentation. Pick one.

爱*していゐ 2024-12-13 16:23:50

随心所欲地给它上色。作为一行本身,您无法确定是否应将其解释为 /** */ (文档)或 /* * */ (单个注释星号)或/* **/ (奇怪的评论)。您可以尝试通过查看上一行和下一行来推断它是否是文档。如果其中任何一个都是文档,那么这个小 /***/ 很可能也是文档。

Color it however you want. As a line by itself, you cannot determine if it should be interpreted as /** */ (documentation) or /* * */ (a single commented asterisk) or /* **/ (oddball comment). You could try and infer if it's documentation or not by looking at the previous and next lines. If either of those are documentation, then most likely this little /***/ is documentation as well.

我偏爱纯白色 2024-12-13 16:23:50

javadoc 注释风格不是该语言的扩展;而是该语言的扩展。它不是实际 Java 语法的一部分。所以本质上每个 javadoc 注释首先是注释,然后才是 javadoc。因此,我会使用“普通评论”作为默认值。

The javadoc comment style was not an extension of the language; it is not part of the actual Java syntax. So essentially every javadoc comment is a comment first, and javadoc second. For that reason, I would use "normal comment" as the default.

箹锭⒈辈孓 2024-12-13 16:23:50

如果您将 /** */ 视为文档,那么您也应该将 /***/ 视为文档 - 零长度文档之间没有太大的实际区别和仅空白文档。

我认为它也更容易实现 - 否则你必须将 /***/ 视为特殊情况(可能涉及某种前瞻)。

If you are treating /** */ as documentation then you should also treat /***/ as documentation - there isn't much practical difference between zero-length documentation and only-whitespace documentation.

I think it's also easier to implement - otherwise you have to treat /***/ as a special case (probably involves some-kind of look-ahead).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文