0

What is main difference between abstract class and interface in java?

can anyone explain with real time example??please

28th Aug 2017, 3:29 PM
Swetha Srilakshmi
Swetha Srilakshmi - avatar
2 Réponses
+ 2
Abstract classes can have abstract and non-abstract methods . Interface has only abstract methods. Abstract methods do not have body, they just have prototype(method signature), these methods have actual implementation in their child class(in case of abstract classes) or in classes implementing(in case of interfaces) them. i.e Method declared in abstract classes can have body. Methods declared in the interface does not contain body. It has only declaration. Variables,methods declared in interfaces are final i.e they cannot be modified. In case of abstract classes variables may or not be final.
28th Aug 2017, 7:47 PM
shadab gada