public class Constructors { public static void main(String[] args) { System.out.println( new Cube(1,2,3).volume() ); } } class Line { protected int width; public Line(int width) { this.width = width; } } class Square extends Line { protected int height; public Square(int width, int height) { super(width); this.height=height; } } class Cube extends Square { protected int depth; public Cube(int width, int height, int depth) { super(width,height); this.depth=depth; } public int volume() { return depth*height*width; } }