Java Enums

Java Enum with String Values: Create, Convert and Lookup

Learn to create a Java enum with String values, convert an enum to a String with name(), toString() or a getter, and convert a String back to an enum safely with valueOf() or a case-insensitive lookup that returns Optional.

Java Enum Tutorial: What Is an Enum, Constructors, Methods

An enum is a data type with a fixed set of named constants. This Java enum tutorial covers declaring enums, values(), valueOf(), ordinal() and name(), switch and pattern matching on Java 25, constructors, fields and methods, EnumSet, EnumMap, singletons and safe String-to-enum conversion.

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.