Skip to content
lufe089 edited this page Aug 31, 2017 · 1 revision

Utility classes

A class that is only a collection of static utility methods must be named with a Utils suffix, must have a private default constructor, and must be abstract. Making the class abstract and providing a private default constructor prevent anyone from instantiating it. For example:

 public abstract MyUtils {

     private MyUtils() {
         /* prevent instantiation */
     }

     // static utility methods
 }