Asdfasf

Thursday, August 21, 2014

EJ-4 Enforce Noninstantiability with a Private Constructor

Ref: Effective Java by Joshua Bloch

Occasionally you'll want to write a class that is just a grouping of static methods and static fields like java.util.Collections. Such utility classes were not designed to be instantiated, an instance would be nonsensical. A class can be made noninstantiable by including a private constructor.


No comments: