Best practices for Java comments.



Java supports single-line, multi-line comments and documentation comments. Documentation comments are understood by javadoc tool and can be used to create HTML based documentation. Following are the best practices while using comments in Java.

  • Use documentation comments, whenever you want its documentation to be generated.
  •  Multi-line comments are used to comments out unused code.
  • single line comments are preferably used in code and it should be meaningful enough to showcase the purpose of the business logic.

Advertisements