An Abstract class without any implementation just looks like an Interface; however there are lot of differences than similarities between an Abstract class and an Interface.
- Abstract class can contain abstract methods, abstract property as well as other members (just like normal class). In JDK 1.0 it was indeed necessary to have at least one abstract method in an abstract class. This restriction was removed in JDK 1.1 .Whereas an interface is a reference type, similar to a class that can contain only constants, method signatures, and nested types. Methods of a Java interface are implicitly public and abstract, and cannot have implementations.
- A class may inherit several interfaces, but inherit only one abstract class. If we add a new method to an abstract class, there we can provide the default implementation and therefore all the existing code might work properly whereas in interface, we have to track down all the implementations of the interface and define implementation for the new method.
- An interface can extend one or more Java interfaces only (not any abstract class), an abstract class can extend another Java class and implement multiple Java interfaces.
- In comparison with java abstract classes, java interfaces are slow as it requires extra indirection.
- Abstract classes can contain fields that are not static and non- final, whereas all variables defined in an interface must be public, static, and final
- Interface methods must not be static, whereas an abstract class may have static fields and static methods
- Interface is absolutely abstract and cannot be instantiated; A Java abstract class also cannot be instantiated, but can be invoked if a main() exists.