Search code examples
javadoc

proper javadoc comments for two classes


Right now I have to write some comments for my code. The code is like:

/**
 * Provide a block grid of customized size and 
 * a block moving back and forth at the center
 * of the block grid.
 * @author ..
 * @version ..
 */
public class BlockGrid {
    .....
}
/**
 * This is to use the input width, height, and pixel to
 * get the actual pixel and place it.
 */
class MyWindow extends JFrame implements Runnable {
    .....(some ints here)
   /** Constructor
     * use to show the graph of the grid with new height,
     * and width depending on new pixel.
     * @param w This is the logical number of blocks in the 
                width direction.
     * @param h This is the logical number of blocks in the 
                height direction.
     * @param p This is the size of each grid square.
     */
    public MyWindow(int w, int h, int p) {
        .....

    }
}

I know how to write javadoc comments for the public class, but if for the "class" writes just after public class, how to write it's javadoc comments? This class cannot be a public class. For example, here, I write both javadoc comments for these two classes, BlockGrid and MyWindow, somehow, my javadoc comments can only show the public class BlockGrid part as *.html files form for me to check when I do the command javadoc BlockGrid.java on my terminal, but my other classes that are following it cannot show. Thanks


Solution

  • By default, javadoc only includes public and protected classes. Add -package or -private to the javadoc command line to include the documentation for the second class. The javadoc comments themselves do not need to change.