How to quote “*/” in JavaDocs

前端 未结 6 1797
甜味超标
甜味超标 2020-11-30 09:23

I have a need to include */ in my JavaDoc comment. The problem is that this is also the same sequence for closing a comment. What the proper way to quote/escape

6条回答
  •  北荒
    北荒 (楼主)
    2020-11-30 10:06

    /**
     * Returns true if the specified string contains "*/".
     */
    

    This is the ‘right’ solution, but for readability's sake I'd probably go for:

    /**
     * Returns true if the string contains an asterisk followed by slash.
     */
    

提交回复
热议问题