Source of TestRoundShapes.java


  1: //TestRoundShapes.java
  2: //Illustrates an abstract class with an inner class, and
  3: //concrete classes inherited from that abstract class.

  5: import java.io.*;

  7: public class TestRoundShapes
  8: {
  9:     static PrintWriter screen = new PrintWriter(System.out, true);
 10:     
 11:     public static void main(String[] args)
 12:     {
 13:         Circle c = new Circle(5, 5, 2.5);
 14:         Sphere s = new Sphere(5, 5, 2.5);

 16:         //Display areas of a circle and a sphere
 17:         screen.println("\nArea of circle = " + c.getArea());
 18:         screen.println("Area of sphere = " + s.getArea() + "\n");
 19:     }
 20: }