Learn Java Programming - Enum Common Methods Tutorial

preview_player
Показать описание

.name() · Returns a String value of the name of the enum constant.
.ordinal() · Return an int value of where the enum constant resides in the list, just like an index in an array.
.values() · Returns a populated array of enum type objects.
.valueOf(String name) · Returns an enum constant data type matching the string value of the parameter.

Let's jump right into demonstrating these methods in the code below.
Рекомендации по теме