Java supports a special type called an enum—short for an enumeration. An enumeration lets you define a set of mutually exclusive values that can be referenced throughout an application. Just like variables that are static and final, an enum value can only be defined once. By default, it’s stored as an integer value, but like the constants shown in prior videos, those values don’t matter. What matters is that each enumerated value is unique.
- [Instructor] Java supports a special type…called an enum, short for an enumeration.…An enum lets you define a set of…mutually exclusive values that can be referenced…throughout an application.…Just like variables that are static and final, constants,…an enum value can only be defined once.…Enum values are stored internally as integer values.…But like the constants that I've previously shown,…those values don't matter.…What matters is that each enumerated value is unique.…
In this application, I'll go to my utilities package,…and select new, java class.…I'll call the class operation,…but instead of it being a class, I'll choose enum…as the type.…I'll click okay.…And that creates the enum file.…Just like a class, the identifier, that is the enum…has to match the name of the file.…So, the enum operation is stored in operation dot java.…Now, to define the available values,…I'll type in add, comma subtract, and then a semicolon,…and that's all you need to do.…
The actual values will be assigned by the compiler.…And you don't need to put in the extra keywords…
- Debugging Java code
- Handling exceptions
- Creating custom classes
- Working with inheritance
- Managing data collections
- Using Java packages and libraries
- Preparing a Java application for deployment
Skill Level Intermediate
1. Exception Handling and Debugging
2. Create Custom Classes
3. Work with Inheritance
4. Manage Data Collections
5. Use Java Packages and Libraries
Work with dates and times7m 12s
6. Prepare a Java Application for Deployment
Next steps1m 12s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.