Interface VS Abstract class
Difference abstract class vs interface
Abstract class
1)Abstract class can have both an abstract as well as concrete methods.
2)Multiple Inheritance is not supported in abstract class.
3)final, non-final, static , non-static variables are supported.
4)Abstract class declared using abstract keyword.
5)Abstract class can be inherited using extends keyword.
6)Abstract class can have any type of members like private, public.
Inteface -
1)Interface can have only abstract methods.but after Java 8 onwards, it can have default as well as static methods.
2) multiple inheritance is supported by interface.
3) only final and static variables are allowed.
4) inteface is declared using inteface keyword.
5) inteface can only be implemented using implements keyword.
6)Interface can only have public members.
Comments
Post a Comment