类注释必须放在import语句之后,类定义之前。

    下面是一个类注释的例子:

    /**

     * A <code>Card</code> object represents a playing card, such

     * as "Queen of Hearts". A card has a suit (Diamond, Heart,

     * Spade or Club) and a value (1 = Ace, 2 . . . 10, 11 = Jack,

     * 12 = Queen, 13 = King)

     */

    public class Card

    {

        ....

    }

    注释:没有必要在每一行的开始用星号*,例如

    /**

        A <code>Card</code> object represents a playing card, such

         as "Queen of Hearts". A card has a suit (Diamond, Heart,

         Spade or Club) and a value (1 = Ace, 2 . . . 10, 11 = Jack,

         12 = Queen, 13 = King)

     */

    然而,大部分IDE提供了自动添加星号*,并且当注释行改变时,自动重新排列这些型号的功能。