Ankit Garg wrote:In your case the class is actually useless but an abstract class with a private constructor can have uses. What if you add a factory method to the class which returns instances of the class?? Then the class would be useful. Since the compiler cannot check whether its possible to instantiate a class or not (i.e. look for factory methods), so the code is allowed as it doesn't break any rules...
Ok, I agree BUT ... even in a factory method I can't instantiate the class because ... remember .... it's abstract ! And I can't do:
new Clown();
And I can't extend it because it's constructor is private .... so ...... I can't do nothing with this "clown" code !