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.
But there are many differences between abstract class and interface that are given below.
Simply, abstract class achieves partial abstraction (0 to 100%) whereas interface achieves fully abstraction (100%).
Example of abstract class and interface in Java
Let's see a simple example where we are using interface and abstract class both.
Output:
I am a I am b I am c I am d |
Sunday, 12 April 2015
Abstract class and Interface
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment