Inheritance & Polymorphism Examples
u// A parent class for a 2-Dimensional object
public class Box {
  int width  = 2;
  int length = 3;
}
u// A child class for a 3-Dimensional object, which inherits a parent class
public class Cube extends Box {
  int height = 4;
  int width  = 1; //polymorphism - this variable(width) is set to 1.
  int volume = super.width * length * height;
  public Cube() {
    System.out.println("The volume of the cube is: " + volume);
  }

  public static void main(String[] args) {
    new Cube();
  }
}   
More advanced Java concepts