Java java 文档和评论的内存管理

Java memory management for java docs and comments

java程序中的代码注释部分是否存储在内存中?如果存储,存储在内存的哪一部分?

没有。代码的注释部分仅存在于源代码中。

编译代码时删除所有注释。

根据java language specification

  • /* text */
    A traditional comment: all the text from the ASCII characters /* to the ASCII characters */ is ignored (as in C and C++).

  • // text
    An end-of-line comment: all the text from the ASCII characters // to the end of the line is ignored (as in C++).