1. An abstract class is created by using the keyword abstract.
  2. An abstract class can have abstract methods and even concrete method in it.
  3. Concrete methods can be defined in the abstract class where as the Abstract methods are just declared.
  4.  Abstract method prototype  have a semicolon at the end.
  5. The classes extending the abstract class must define all the abstract methods else these methods are again declared abstract in the extended class.
  6. A class can be abstract without possessing any abstract methods.
  7. A class can be abstract while having some concrete method and some abstract methods.
  8. Abstract methods cannot be present in a non abstract class.
  9. Abstract class cannot be instantiated and abstract class are of no use unless they are extended by some other class.
  10. Abstract classes provide partial abstraction while interfaces provide full abstraction.
  11. Abstract class can have data members even static data members can also be present.

Major difference between abstract class and interface.

  • The class have some concrete method and some in abstract methods then declared as abstract class
  • If the class has all the abstract methods then declared as interface.

Advertisements