July 5, 2014
Comments in Java
Comments can appear at anywhere in a class (i.e, before and after the package statement, before and within and after the import statements, before and after the class declaration, before and within and after the variables declaration or methods definition.
In Java Programming Language there are three flavors of comments:
- Single line comments. Starts with // and their effect is until the end of line. They are usually used to briefly describe the related line of code.
- Multi line comments. Starts with /* and ends with */.
- Documentation comments. Start with /** and ends with */. There are some rules related to the usage of documentation comments. However, they are not relevant for the OCA exam, therefore I will not cover them here.
Below is a code that show comments in action :

Take away 1 : Comments are not executable line of code.
Take away 2 : Multiline comments and documentation comments span multiple line of code and they can contain any UNICODE character (including special characters).