Hide the properties and implementation details of objects and expose public access methods to external to prevent arbitrary access and modification of data.
Inherit the methods of the base class and make own extensions.
One interface, multiple implementations.
Example:
class Shape {
void draw() {}
}
class Circle extends Shape {
void draw() {
System.out.println("Circle.draw()");
}
}
class Square extends Shape {
void draw() {
System.out.println("Square.draw()");
}
}
class Triangle extends Shape {
void draw() {
System.out.println("Triangle.draw()");
}
}