Item 3: Enforce noninstantiability with a private constructor

Java natively allows for inheritance on all classes, simply because it does not allow a class to be defined as static.
I do not understand the internal workings  to this, but I believe it is derived from C++.

Thus we end up with a class of static members but it can be instantiated which is incorrect.
To prevent this false relay of information to the consumer of the class, it is best to make the CLASS non-instantiable.

public class myTestClass
{
   // Suprress default constructor for non-instantiability
   private myTestClass() {
   }
}

Don't be shellfish...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on TumblrEmail this to someone