Comments that begin with "/**
" and end with
"*/
" are considered to be javadoc comments. You can put
javadoc comments before class, interface, field (class member
variable), constructor and method definitions. The first sentence
should be a brief description of the class, or variable, or whatever.
After that, you can put some tags, which begin with "@
",
as described in Prof. Yap's page.
You don't actually have to have the special comments to run javadoc on
your program. Even without the comments, each public class, and each
public or protected variable and method, will be documented. If you
put in the special comments, then these will be added to the
documentation. Classes, methods, and variables that are not
public
or protected
will not be included in
the documentation. (Actually, that is the default behavior of the
program; you can modify this behavior, as explained in the
reference
.
When you run javadoc, several new html files will be created:
classname.html
if classname
is
the name of the class. This page will list all public and protected
constructors, methods and variables in the class, with their
signatures, so that anyone could know how to use this class without
actually looking at the source code.
AllNames.html
will
be created which indexes, and links to, documentation for all of the
names of class, method, variable, etc., in the program (which will in
general include multiple classes).
tree.html
gives an inheritance hierarchy for all classes
in the program.
packages.html
provides an index
for the packages in your program. For a simple program that does not
declare any new packages, this file will be essentially empty.
You should run javadoc on all the java files in the program at once, like this (on unix):
javadoc *.java
I have run javadoc
on all the
examples
and
solutions
.
NOTE: When you put files on the web, they must be world readable. On a unix machine like acf5, you can say
chmod a+r *to make all the files in a directory world readable.