next up previous contents index
Next: Arrays Up: Data types Previous: Exceptions   Contents   Index


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.0.0
users_guide Last Modified 2006-07-21

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