Use Private Constructor in Utility Classes

To prevent someone instantiating an utility class, use private constructor.

public class Utilities {
    // Enforce noninstantiability.
    private Utilities() {}
}

This also prevents someone sub-classing it.

Creative Commons License
This blog by Che-Liang Chiou is licensed under a Creative Commons Attribution 4.0 International License.