Well, the title is self-explanatory. I wondered this while compiling a project which has a lot of lines commented. It's a bit silly because the jar file wouldn't increase much (some bytes) but I'm curious if this could affect a program with a lot of code and comments.
Thanks
It would not affect the execution or performance (unless you have commented out the wrong statements :-)
But it definitely would affect readability. There is no reason to have large blocks of commented out code (in production), version control is the way to go
See this question also.Question closed.No, this is not added.
However, you should consider to kill dead code (i.e. commented code, but also unused code). If you think that "maybe I will need that method again", simply delete the method, and if you really need this method some day, use you SCM tool (Subversion, Git, CVS or whatever) to retrieve this old code...
No, comments normally are stripped out in any language (not just in Java). They have no representative in byte code. What stays in there, is annotated stuff and such
No, documentation isn't included in the compiled class file.
The javadocs can be generated with the
javadoc
program. All javadoc will be converterd to HTML.Yes JAVA includes comment in the compiled code because without including how it will come to know that whether this is a comment or not . But after including the commented line is not sent to compiler directive for compilation.