File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes what each part of this program does Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "what each part of this program does" Watch "what each part of this program does" New topic

what each part of this program does

jake bellhorn

Joined: May 03, 2006
Posts: 24

ive tried to comment on things in the program that i knew, im not sure if i got them right, what other key things in this program should i comment on, what do they do?
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

When commenting a program, we usually try to not overcomment it. Obvious things should not be commented.
You have written : // clac is the name of the class
First, you've got the wrong class name in your comment (no big deal). But, no comment is better than a bad comment
Second, such obvious things do not need to be commented.

[My Blog]
All roads lead to JavaRanch
marc weber

Joined: Aug 31, 2004
Posts: 11343

Labeling variables is a start. But if you want to take this code apart to understand how it really works, I suggest that you look at each class separately. In other words, understand the different types of objects that work together in this program, examining their methods to understand what each class does.

Once you have the pieces figured out, then work through the path of execution -- looking at what is called when.

Also, there are depreciated methods here. If you compile with...

javac -Xlinteprecation will generate a list of the depreciated methods. You should check the API to see what these methods have been replaced with.
[ June 20, 2006: Message edited by: marc weber ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Is this a piece of code you found somewhere on the net, and are thinking about turning in for an assignment of yours?
marc weber

Joined: Aug 31, 2004
Posts: 11343

jake, here again, you need to at least cite your source, since this code is copyrighted material...

(If this was submitted as an assignment, I expect a professor would recognize the code was not written in "modern" times, given the depreciated awt methods. A quick search of the internet would find several examples of this exact code.)
I agree. Here's the link:
subject: what each part of this program does
It's not a secret anymore!