Enumerations in Java | Enum in Java

Опубликовано: 27 Сентябрь 2021
на канале: Academy of Fine Learning
199
8

Enumerations serve the purpose of representing a group of named constants in a programming language. For example, the 4 suits in a deck of playing cards may be 4 enumerators named Club, Diamond, Heart, and Spade, belonging to an enumerated type named Suit. Other examples include natural enumerated types (like the planets, days of the week, colors, directions, etc.).
Enums are used when we know all possible values at compile time, such as choices on a menu, rounding modes, command line flags, etc. It is not necessary that the set of constants in an enum type stay fixed for all time.

In Java (from 1.5), enums are represented using enum data type. Java enums are more powerful than C/C++ enums. In Java, we can also add variables, methods and constructors to it. The main objective of enum is to define our own data types(Enumerated Data Types).

0:00 Intro
0:53 Quick Enum Example
4:40 Values() and ordinal() example
7:00 Enum outside the class example
9:50 Enum inside a class example
11:49 Enum values using constructors
15:24 Using Enum constructors
17:20 methods in Enum example
21:00 Theoretical discussions
25:05 Enum with Switch case example


На этой странице сайта вы можете посмотреть видео онлайн Enumerations in Java | Enum in Java длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Academy of Fine Learning 27 Сентябрь 2021, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 199 раз и оно понравилось 8 зрителям. Приятного просмотра!