views:

134

answers:

2

Possible Duplicate:
Abstract class constructor in Java

When we can't create an instance of abstract class, what is the purpose of a constructor?

+6  A: 

You can still extend the abstract class and call the abstracts class' constructor in your derived class.

Joachim Sauer
A: 

I often create a constructor with some parameters (and don't create empty constructor) in abstract class and in this way I make all subclasses to have constructor with all these parameters. This approach guarantees that subclasses are initialized correctly.

But in my last few projects I use spring with its dependency injection for this purpose.

Roman