Algorithms and OOD (CSC 207 2014S) : Labs
Summary: In this laboratory, you will have the chance to improve your skills regarding code documentation and testing.
Open your project from the inheritance lab in Eclipse.
You need not add comments to those classes. (At least not yet.)
a. Use Eclipse's Javadoc tool to generate Javadoc for these classes.
You can generate Javadoc by selectingfrom the menu.
That tool will ask you where to put the documentation. You can
put it within your project, but you may find it useful to put
it elsewhere, such as in your
(presuming you have such a directory).
b. Preview the Javadoc documentation in Eclipse.
c. Preview the Javadoc documentation in your Web browser. You will
use a URL like
As you may recall, a Javadoc-style comment begins with a slash and two stars and ends with a star and a slash. Add some Javadoc-style comments to various portions of your classes, rebuild the documentation, and determine the effects.
You may have noted that the Javadoc documentation does not list package methods and fields. Figure out how to get the Javadoc documentation to reveal more or fewer components.
Although the Javadoc designers did not acknowledge the need for preconditions and postconditions, we know that they are quite useful.
a. Add a precondition to the Javadoc documentation for a method
b. Add a postcondition to the Javadoc documentation for a method
c. What do you expect to happen when you generate the documentation?
d. Check your answer experimentally.
e. As you probably discovered, Eclipse doesn't yet know about these tags. Configure the Javadoc tool to add the following flags.
-tag pre:cm:"Preconditions:" tag post:cm:"Postconditions:"
Copyright (c) 2013-14 Samuel A. Rebelsky.
This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.