public class Vegetable
   {
   protected Vegetable()
      {
      // constructor has no fields to initialise
      }
   public static final Vegetable unknown = new Vegetable();
   public static final Vegetable beet = new Vegetable();
   public static final Vegetable broccoli = new Vegetable();
   public static final Vegetable carrot = new Vegetable();
   } // end class Vegetable
public class JuiceBar
   {
   public void mixIn ( Vegetable v )
      {
      if ( v == Vegetable.broccoli )
         {
         /* ... */
         }
      }
   // ...
   } // end class JuiceBar