This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
If the answer is we can not create an object of an Interface then why it not applicable to abstract class. Though we cannot create an abject of abstract class still we can define Constructors in side it which can be called from subclass constructors by using super keyword. Why cant we do the same for interfaces?
The job of the constructor is to initialize the member variables. Abstract class can have member variables. Interface doesn't. So, Abstract class can have constructor. Interface doesn't need constructor. Nothing to intialize; No constructor required
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32675
4
posted
1
And welcome to the Ranch
devasis majhi
Greenhorn
Joined: Dec 29, 2012
Posts: 9
posted
0
The job of the constructor is to initialize the member variables. Abstract class can have member variables. Interface doesn't.
Not completely agree with it. Even Interface can have member but those are static and final by default which can not be initialized in a constructor. Probably that is is the reason we don't have constructors in Interface.
Correct me if I am wrong.