Javadoc

In this course, we will be commenting our code with what is called Javadoc. Javadoc is a standiardized way of commenting methods, objects and files that is used by almost all proffessional devolpers.

Multi-line comment blocks in Java start with /* and are closed with a */. In order to comply with the javadoc format, we will begin our method and class comments with /** instead. Below that should be a brief description of what the method or file does.

The thing that is special about javadoc is it allows us to tag important information about the method we are commenting. Each method comment, after the description of what the method does, should have the string @precondition, followed by an explanation of the precondition. Following that should @postcondition with an explanation of a post condition, @param describing the parameters the method takes, and @return describing the return type.

We use javadoc to allow Eclipse and other javadoc programs to format information about our methods in a standerdized and aesthitcally pleasing way. Below is an example created in Eclipse of a simple javadoc commented method and the resutling documentation.

Sample Javadoc