This question already has answers here:
Closed 8 years ago.
Possible Duplicate:
Interface vs Abstract Class (general OO)
When to use abstract class or interface?
Can you provided implementations on a abstract class?
what's the difference between these two?
and when will I know when will I know to use them?
This pages gives a good comparison: http://download.oracle.com/javase/tutorial/java/IandI/abstract.html . You could have found it with a very quick google search.
Interface
is used for defining a contract. Abstract classes are used for defining some methods which are common to all descendants and possibly some methods which will differ(they will be abstract
). With interfaces
or abstract classes
polymorphism is reached.