+ 2
What is difference between abstract and interface
2 Answers
+ 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.
+ 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.
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||