bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/Java/Java Reference
Java•Java Reference

Java enum Keyword

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind Java enum Keyword?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Order

Put the learning moves in the order that makes the concept easiest to apply.

An enum is a special "class" that represents a group of constants (unchangeable variables, like final variables).
The enum keyword declares an enumerated (unchangeable) type.
Definition and Usage

❮ Java Keywords

enum

Definition and Usage

The enum keyword declares an enumerated (unchangeable) type.

An enum is a special "class" that represents a group of constants (unchangeable variables, like final variables).

To create an enum, use the enum keyword (instead of class or interface), and separate the constants with a comma. Note that they should be in uppercase letters.

An enum can, just like a class , have attributes and methods. The only difference is that enum constants are public , static and final (unchangeable - cannot be overridden).

An enum cannot be used to create objects, and it can not extend other classes (but it can implement interfaces).

Use enums when you have values that you know aren't going to change, like month days, days, colors, deck of cards, etc.

Related Pages

Read more about enums in our Java Enum Tutorial .

❮ Java Keywords

Previous

Java else Keyword

Next

Java exports Keyword