Also, I'm hesitant to call anything regarding enums and State Machines a "secret", no matter the language. What IS cool about Java enums, though, is that they can encapsulate behavior. Building a state machine with C# or C enums involves defining the enum and then writing a giant switch statement (often in several places) or making a generic callback registration engine.
EDIT: Are there any other languages that do cool things with enums like this? I was delighted the first time I learned you could do this in Java.
One way around this if you're in, say, C#, is to just forget enums and use a static class...
class State {
static State Init = () -> // do stuff
static State Running = () -> // do running stuff
static State Close = () -> // do closing stuff
static void NewState(State state) {
state()
}
And you can reference the states just like enums: if (someState == State.Init) // then do something with it
(I know this isn't syntactically correct C#... I haven't used the language in over a year now.)