Interface
All methods are abstract and there is no implementation.
No access modifiers are allowed.
Interfaces are essentially having all method prototypes no definition
We can achieve multiple inheritance through interface
Abstract class
Some methods can be concrete.
They have access modifiers
Contain method definitions also.
We can achieve only single inheritance and multi-level inheritance
It can not be instantiated
RE: What is difference in an Abstract Class and an Int...
An Abstract class has abstract methods. An Abtsract class can not be instanitiated directly. All the abtract methods are implemented in the derived class. There is no multiple inheritance here.
Interface class also has abstract methods and all of them are public. You can have multiple inheritance with Interfaces.
RE: What is difference in an Abstract Class and an Int...
Ans:
In an interface class all methods are abstract - there is no implementation. In an abstract class some methods can be concrete. In an interface class no accessibility modifiers are allowed. An abstract class may have accessibility modifiers.
RE: What is difference in an Abstract Class and an Int...
the interface will have all absract method the absract will contain one or more absract method all the methods the interface has to be implemented but it is not req to implemne t all the methods in absract class
RE: What is difference in an Abstract Class and an Int...
Interface :
1. All the methods in the interface are abstract. 2. We can achieve multiple inheritance through interface. 3. All the methods in the interface should be without Access modifier. Implicitly public.
Abstract class:
1. Abstract class may contain abstract method and non-abstract method. 2. We can achieve only single inheritance and multi-level inheritance. 3. Abstract methods have Access modifiers.
RE: What is difference in an Abstract Class and an Int...
Abstarct class is like normal class with 2 specials. 1. It can not be instanciated 2. It can have abstarct functions. Abstract class is used in inheritance as super class where some common implementation is requried.
Example is Thread class
interface is different type than class. All the members are public and no implementation is allowed. Interfaces are used for 1. For declaring project level constants because all variables public final and static. 2. In delegation pattern for providing flexibilty of implementation.
RE: What is difference in an Abstract Class and an Int...
Abstract class:
1. Abstract class may contain abstract method and concrete method(means having own implemantion). 2. Abstract methods have Access modifiers(Public protected internal etc).
Interface :
1. All the methods in the interface are abstract. 2. We can achieve multiple inheritance through interface. 3. Donot have access Modifiers by default is PUBLIC
RE: What is difference in an Abstract Class and an Interface.
Besides the rules difference between of interfaces and abstract class keep this also in mind.
Abstract classes promotes high cohesion while interfaces provides loose coupling. High cohesion and loose coupling are considered as the best design strategy for complex software designs.