COP 2210 Laboratory 8 - Java “Documentation Comments” and Packages
Partner 1 Name and Section: ______
Partner 2 Name and Section: ______
Objectives:
w To practice creating and using packages
w To practice writing Java documentation comments for our classes, methods, parameters,
and return values, and creating the html “help” pages
Begin by downloading these 2 files from the class web page and storing them in the src folder of your project:
Circle.java Time.java
Exercise 1:
F Refer to the online documents “Packages” and “Using the Javadoc Utility in NetBeans” for detailed instructions
- Open and examine Circle.java. Note the Java “documentation comments” for the class and for each method, parameter, and return value
- Create a package with an appropriate name in the src folder of your project
- Using the Refactor command, move Circle.java into your package folder
- Generate the html “help” pages for the Circle class
F From the Run menu, choose “Generate Javadoc”
- Open the file Circle.html in your browser and note how each documentation comment appears in the web page (in the NetBeans Files pane, right-click on the Circle.html icon and click View)
F Circle.html will be found in a folder with the same name as your package folder, in a folder called javadoc, in the newly-created dist folder
- Open the file CircleTest.java and note that NetBeans has added the necessary import statement. Also note that the required package statement has been added to Circle.java
Check: ______
Exercise 2:
F If necessary, refer to the online document “Java Documentation Comments”
- Open Time.java and carefully read the comments describing the class and its methods
- Using Circle.java for reference, add the proper Java documentation comments to the Time class. Be sure to document the class and every method, parameter, and return value
- Create another package with an appropriate name in the src folder of your project
- Using the Refactor command, move Time.java into your new package folder
- Generate the html “help” pages for the Time class
- Open the file Time.html in your browser (or NetBeans) and make sure all of the necessary information appears. If not, correct the documentation comments (or add the missing ones) and create the html file again
- Note that the required package statement has been added to Time.java
Check: ______