Brian

40%
Flag icon
Luckily, there is a better way to associate a different behavior with each enum constant: declare an abstract apply method in the enum type, and override it with a concrete method for each constant in a constant-specific class body. Such methods are known as constant-specific method implementations:
Brian
Wait you can’t do this instance-level implementation with ordinary classes, right?
Robert
· Flag
Robert
What do you mean by this? These are essentially just shorthand for subsclasses with method implementations/overrides.
Effective Java
Rate this book
Clear rating
Open Preview