/* * File: Square.java * Author: Java, Java, Java * Description: This class illustrates how inheritance works. * The Square class extends the definition of the * Rectangle class as a way of representing a simple * geometric square. The Square class inherits the public methods * its superclass (Rectangle). Note how a square is * created by simply calling its superclass's constructor * and passing it "side" as the value for both its length * and width. * * Given this definition, it will be possible to create * square instances and calculate their areas: * Square square = new Square (100); * System.out.println( "square's area is " + square.calculateArea() ); */ public class Square extends Rectangle // Subclass of Rectangle { public Square(double side) { super(side,side); // Call Rectangle's Constructor } } // Square