Abstract class is designed to be subclassed. when you instantiate the subclass. the subclass constructor access the super class constructor to initialize the instance variable of super class which might be used into your subclass.
for an example:
Seetharaman Venkatasamy wrote:Abstract class is designed to be subclassed.
Yes, but that does not explain why it is allowed to have a public or private constructor in an abstract class.
I guess that Raj thinks like this: when I create an abstract class with one constructor, which is private, then I can't subclass the abstract class - because a subclass constructor can't call the private constructor. So it is strange that Java allows this - an abstract class that you must subclass, but you can't because it has a private constructor; and you can't instantiate it either because it is abstract?
The answer is that a class can have more than one constructor, and you might for some reason make one or more of your constructors private. The other, non-private constructors could still be called by subclass constructors. The private constructors could be called by other constructors in your abstract class.
For public constructors, I don't know why Java allows them in an abstract class. Since the class is abstract you can't instantiate it, so the only possibility to instantiate it is via a subclass. But public access isn't necessary for that; protected access would be enough.