Enumerations

Enumerations are implemented as final static ints in their own Java class and, as such, are accessed just like variables in that class. Recall the specification of a car enumeration type, from Section 5.3 and repeated below, defines three constants$:$ porsche, ford, and mercedes.


  enum car { 
    porsche = 911, 
    ford = 150, 
    mercedes = 550
  };

The value of the porsche constant, for example, can be accessed through enums.car.porsche.





babel-1.4.0
users_guide Last Modified 2008-10-16

http://www.llnl.gov/CASC/components
components@llnl.gov