Abstract Class

Can Abstract Class have an Constructor? Why or Why not?

Yes, abstract class can have constructor. Reason: Constructor in Java are methods to initialize the fields and not creating the object.

Example: In case you have some implementation and you would want to initialize some fields in a specific way, you would create a constructor. All sub-classes would class "super" and this this constructor.

Example:

abstract class Product { int multiplyBy; public Product( int multiplyBy ) { this.multiplyBy = multiplyBy; } public int mutiply(int val) { return muliplyBy * val; }}class TimesTwo extends Product { public TimesTwo() { super(2); }}class TimesWhat extends Product { public TimesWhat(int what) { super(what); }}