An interface is a collection of abstract methods that must be implemented by any class that implements the interface. An abstract class is a class that contains one or more abstract methods that must be overridden by any class that extends the abstract class.

Example:

Interface:

public interface Shape {
public void draw();
public double getArea();
}

Abstract Class:

public abstract class Shape {
public abstract void draw();
public abstract double getArea();
}

Leave a Reply

Your email address will not be published. Required fields are marked *