What are some of the advantages of creating an enumeration type?

What will be an ideal response?

Creating an enumeration type provides you with several advantages:
* If you did not create an enumerated type for month values, you could use another type-for example, ints or Strings. The problem is that any value could be assigned to an int or String variable, but only the 12 allowed values can be assigned to a Month.
* If you did not create an enumerated type for month values, you could create another type to represent months, but invalid behavior could be applied to the values. For example, you could add or subtract two months, which is not logical. Programmers say using enums makes the values type-safe. Type-safe describes a data type for which only appropriate behaviors are allowed.
* The enum constants provide a form of self-documentation. Someone reading your program might misinterpret what 9 means as a month value, but there is less confusion when you use the identifier OCT.
* As with other classes, you can also add methods and other fields to an enum type.

Computer Science & Information Technology

You might also like to view...

Queries can be created using Design view

Indicate whether the statement is true or false

Computer Science & Information Technology

A setting that refers to the order in which the focus moves from field to field

a. Auto-increment order b. Tab order c. Focus order

Computer Science & Information Technology