1
Reply

what is the difference between interface and abstract class?

neeru sharma

neeru sharma

12y
1.1k
0
Reply

    The differences between Abstract Classes and Interfaces are as follows :
    1. An abstract class is a class that can not be instantiated but that can contain code whereas an interface only contains method definitions but does not contain any code.
    2. Interfaces do not come in inheriting chain , while abstract classes come in inheritance.
    3. Classes can implements any no. of interfaces, but extends only one abstract class.
    4. An interface can have only abstract methods. An abstract class can have both abstract methods and concrete methods.
    5. Interfaces cannot have constructors. Abstract class can have constructors.
    6. We should initialize variables in an interface whereas it is not necessary to initialize variables in an abstract class.