2014-11-04 46 views
-1

我想知道我怎么能写这样的:评论在java中

this comment */ ends here 

在Java中的注释。我在互联网上搜索了一个小时,但没有结果。如果我写:

/* this comment */ ends here */ 

然后注释将在第一个*/结束。 请注意,我想使用/* */评论,而不是//评论。 谢谢!

+1

为什么你要嵌入* /在评论? – 2014-11-04 21:37:08

+0

我想要字符串这个评论* /结尾在这里 - 在类型的评论/ * */ – user3776836 2014-11-04 21:37:32

+0

这是我在学校的问题 – user3776836 2014-11-04 21:37:53

回答

0

/* * /评论风格绝对需要两个字符对。它不允许除注释结尾处以外的结尾字符对。我可以来回答我认为你问的问题最接近的是:

/* this comment */ 
/* ends here */ 
+0

谢谢。我想我必须使用//然后 – user3776836 2014-11-04 21:41:52

0

由于* /有一个价值的语言,你需要惹* /使它不同。 你能说...

this comment */ends here 

this comment *\ ends here 
4

号你不能嵌入在评论一个*/评论与/*打开。遇到第一个*/时,评论关闭。

1

它可以这样做:

/** this comment */ ends here */ 

*是*的HTML字符代码,当评论被加工成文件,只有*会留下。

举个例子:

enter image description here

+0

是的......但从上下文来看,OP显然不是在谈论javadoc评论。 – 2014-11-04 21:44:37

0
/* this comment */// ends here */ 

/* this comment *//* ends here */ 

/* this comment */ /* ends here */