在javadoc <pre> code snippet

时间:2018-04-04 13:46:36

标签: java javadoc

Given the following javadoc documented snippet:

/**
* Code example:
*
  <pre>
    // call foo like this:
    foo("/**/*/?.txt");
  </pre>
*
*/
public void foo(String glob) {
}

How can I properly escape character sequences like /** and */ in a <pre> block in javadoc?

I've tried {@code} and backslashes, but either the escape characters show in the resulting javadoc or the code does not compile because the javadoc block ends prematurely.

1 个答案:

答案 0 :(得分:1)

您可以使用&#47;代替/,这不会结束JavaDoc评论。