Joe Soltzberg

27%
Flag icon
Normally a utility class requires clients to qualify constant names with a class name, for example, PhysicalConstants.AVOGADROS_NUMBER. If you make heavy use of the constants exported by a utility class, you can avoid the need for qualifying the constants with the class name by making use of the static import facility:
Joe Soltzberg
Only keep the class name if it provides helpful context
Robert
· Flag
Robert
Personally, I'd make the recommendation the opposite way: only static import (remove the class name) if you're sure the context is not necessary for others.
Effective Java
Rate this book
Clear rating
Open Preview