Possible Duplicate:
When to use abstract class or interface?
I know about abstract classes and interfaces. But I wish to know a real time scenario in which we need to use only abstract class but not interface and only interface but not an abstract class.. Can any one suggest me some example like that.
I guess the second one is used when multiple inheritance need arises i.e. A class is already inheriting some class and so we cant use an abstract class here .. We need to use only interface. In the same way I need an example In which we use only abstract but not interface.
EDITED
Just to add some more points for interface.
Consider the java library collections
Collections
List Set
All 3 are interfaces but the major thing , though they have functions which are common that is add , addAll, contains,containsAll etc. List implements in its own and set implements in another way ( telling about duplication ). Set does not allow duplicates list allows duplicates.
So what I am trying to say is when ever there is no common features for sub-interface of super-interface we have to go for interface
But if there is some common functionality which both has then keep it as to be abstract class.
I need a practical example done in java api. Thanks. Sindhu