

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


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.
Interface can have only abstract method have default and static methods also.
Interface supports multiple inheritance
Interface has only static and final variab
Interface can't provide the implemen class.
The interface keyword is used to declare
An interface can extend another Java inter
An interface class can be implemente implements?.
Members of a Java interface are public by d
Example: public interface D void draw(); }
Simply, abstract class achieves partial abstraction (0 to 100%) whereas interface achieves fully abstraction (100%).
Let's see a simple example where we are using interface and abstract class both.
Creating abstract class that provides the implementation of one method of A interfac e
Creating subclass of abstract class, now we need to provide the implementation of re st of the methods
Test it Now
Output:
I am a I am b I am c I am d