Chapter

More Tricks

From ComputerScienceOne by Dr Chris Bourke

Concepts

  1. How do you declare and use an enumerated type in Java?

    "In the example, since the name of the enumeration is Day this declaration must be in a source file named Day.java. We can now declare variables of this type. The possible values it can take are restr

  2. What advantages do enumerated types provide in Java?

    "Using an enumerated type has two advantages. First, it enforces that only a particular set of predefined values can be used. You would not be able to assign a value to a Day variable that was not alr

  3. What built-in methods and customization options do Java enum types provide?

    "Every enum type has some additional built-in methods that you can use. For example, there is a values() method that can be called on the enum that returns an array of the enum’s values. You can use a

More Tricks | ComputerScienceOne | Bifalgorithm | Bifalgorithm