O'Reilly logo

Java, A Beginner’s Guide, 5th Edition by Herbert Schildt

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 12: Enumerations, Autoboxing, Static Import, and Annotations

1. Enumeration constants are said to be self-typed. What does this mean?

In the term self-typed, the “self” refers to the type of the enumeration in which the constant is defined. Thus, an enumeration constant is an object of the enumeration of which it is a part.

2. What class do all enumerations automatically inherit?

The Enum class is automatically inherited by all enumerations.

3. Given the following enumeration, write a program that uses values( ) to show a list of the constants and their ordinal values.

Image

4. The traffic light simulation developed in Try This 12-1 can be ...

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