+ 2

What is difference between abstract and interface

14th Mar 2017, 3:10 PM
Ram Naresh Arya
Ram Naresh Arya - avatar
2 Réponses
+ 6
Think of interface as a class with abstract methods only. Abstract means you declare it but don't implement it. In an interface it is true about every​ method. Later when you are good in Java you will see that it the life is a bit more difficult.
14th Mar 2017, 8:26 PM
Tamás Barta
Tamás Barta - avatar
+ 1
Abstract class and interface both are used to achieve abstraction where we can declare the abstract methods. Abstract class and interface both can't be instantiated. ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| The basic difference between them----->>>> ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| (1) Abstract class doesn't support multiple inheritance &>😎<& Interface supports multiple inheritance. |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| (2) The abstract keyword is used to declare abstract class.&<😎>The interface keyword is used to declare interface. ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| (3) Abstract class can have final, non-final, static and non-static variables.&<😎>Interface has only static and final variables. |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
19th May 2017, 4:11 AM
Nikhil
Nikhil - avatar