Effective Java Study Note - Enforce noninstantiability with a private constructor
Sometimes you need to have a class has only static fields and static methods, like java.lang.Math. For this kind of class, add a private constructor to avoid instantiating by mistake.
No comments:
Post a Comment