| Color enumeration which demonstrates how to define the constants in a
different class to the Enum. The extra static{} block is
needed to ensure that the enum constants are created before the
static methods on the ColorEnum are used.
The class loader sees the two classes here as independent - the enum
class is nested, not an inner class. The static block thus forces the
class load of the outer class, which is needed to initialise the enums.
author: Stephen Colebourne version: $Id: NestLinked.java 437554 2006-08-28 06:21:41Z bayard $ |