

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


CMSC 131 Spring 2008 Jan Plane (adapted from Bonnie Dorr)
CMSC 131 Spring 2008 Jan Plane (adapted from Bonnie Dorr)
1
CMSC 131 Spring 2008 Jan Plane (adapted from Bonnie Dorr)
2
Arguments to main
Recall prototype of main method
Demonstration from Command Line
Demonstration from within Eclipse
CMSC 131 Spring 2008 Jan Plane (adapted from Bonnie Dorr)
3
Types of Documentation
Two kinds of code commentary in Java Implementation comments Interface comments JavaDoc from inside Eclipse from outside of Eclipse Common Errors in Commenting Too many comments: This can obscure the flow of your program. Too few comments: Your intent may not be understood (code is never “self-documenting”!) Comments that repeat the code: int total = 0; // initialize integer total to 0 Using comments to conceal unclear code: …just rewrite the code double a = h*w; // set the area (a) to the height (h) // times width (w) double area = height * width; Uninformative comments: “What the heck does that mean?” double d = processValue( ); // Change later (legacy) Misleading / erroneous comment: These are dangerous for ( int i = 0; i < a.length-1; i++) // run through the //whole array