Inheritance in Java

A class may extend another class by adding methods and fields and by replacing (overriding) methods and fields by new implementations. The extended class is called a subclass. The original class is the superclass.


Example:

class Pixel extends Point {
    public Color color;

    public Pixel(x, y, col) {
      super(x, y);
      color = col;
    }
}