2014-11-04 116 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 */