/** and /* in Java Comments

前端 未结 9 731
庸人自扰
庸人自扰 2020-11-28 19:22

What\'s the difference between

/**
 * comment
 *
 *
 */

and

/*
 * 
 * comment
 *
 */

in Java? When shou

9条回答
  •  佛祖请我去吃肉
    2020-11-28 20:03

    Java supports two types of comments:

    • /* multiline comment */ : The compiler ignores everything from /* to */. The comment can span over multiple lines.

    • // single line : The compiler ignores everything from // to the end of the line.

    Some tool such as javadoc use a special multiline comment for their purpose. For example /** doc comment */ is a documentation comment used by javadoc when preparing the automatically generated documentation, but for Java it's a simple multiline comment.

提交回复
热议问题