Abstract Class
An abstract class may contain concrete method.
To use an abstract class, you need to inherit it. Provide body to (override) the abstract methods if there are any.
Members of an abstract class can be public, private, protected or default.
Example:
- public abstract class Shape{
-
public abstract void draw();
-
}
-
Interface
All the methods of an interface are abstract.
To use an interface you need to implement the interface and provide body to (override) all the abstract methods of it.
All the members of the interface are public by default.
Example:
-
public interface Drawable{
-
void draw();
-
}
-