/** Driver.java -- Let's practice using objects of inherited classes. * For example, both rectangles and spheres are specific kinds of shapes. * * One interesting feature of inheritance is that when we declare our * shape objects s1 and s2 below (not terrific names for variables!) * we could have declared them to be of type Shape. However, to call the * proper findArea or findVolume functions, we would need to use a cast * like this: ((Rectangle) s1).findArea(). */ public class Driver { public static void main(String [] args) { Rectangle s1 = new Rectangle("office", 14, 18); Sphere s2 = new Sphere("volleyball", 4.5); System.out.println("The " + s1 + " has an area of " + s1.findArea()); System.out.println("The " + s2 + " has a volume of " + s2.findVolume()); } }