This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
When you extend a abstract class and instantiate an object of subclass, it not only calls its own constructor but also all the superclass constructors in the inheritance hierarchy up to java.lang.Object. There might be some other reasons too. Can someone throw some light on this?
Things get difficult when we don't have the exact context.
when somebody asks: "does he have a credit card?" and is answered "he should have one" isn't the same as saying "he should have one" without the context. It just means "he probably does"
in any case, if the question is "should we provide a constructor to abstract classes", the answer is, "it depends on your needs", but no, its not necessary all the time. the compiler provides a default constructor to handle subclassing problems.
but if the thing was said in a "do's and don'ts" list, then YES, every class should have a constructor to make it more readable and improve clarity.
"It's not enough that we do our best; sometimes we have to do<br />what's required."<br /> <br />-- Sir Winston Churchill
If the abstract class implements a subset of behavior (some methods) you may need to establish the state on a new instance (ex: set private instance variables) and doing this in the constructor is the way to go.