O'Reilly logo

Just Java™ 2 by Peter van der Linden

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Static, Final, and Enumerated Types

  • What Field Modifier static Means

  • What Field Modifier final Means

  • Why Enumerate a Type?

  • Statements Updated for Enumerations

  • More Complicated Enumerated Types

  • Some Light Relief—The Haunted Zen Garden of Apple

image

Enumerated types were brought into Java with the JDK 1.5 release. They are not a new idea in programming, and lots of other languages already have them. The word “enumerate” means “to specify individually”. An enumerated type is one where we specify individually (as words) all the legal values for that type.

For a type that represents t-shirt sizes, the values might be small, medium, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required