What your teacher probably asked is, is there a way you can still have a copy of the comments in code after compilation. The simple answer is "YES".
And how ? Well, you need to code your java programs with "javadoc" compatible comments. Once this is done, you can autogenerate javadoc html pages out of this which organises your code comments in a standardized javadoc format, which could be of use to the future users of your class files.