To receive an enum based on a specific value, you may utilize the enumValueOf() function or the valueOf() function. For illustration, you may use Fruit if you have an enum named Fruit and wish to retrieve the enum constant based on the enum with the value “APPLE” .valueOf(“APPLE”) or enumValueOf(“APPLE”). Both functions will return the enum constant that matches the given meaning.