1: //RoundShape.java
2: //An abstract class
4: public abstract class RoundShape
5: {
6: //Note this "inner class".
7: //It is used somewhat as a C++ struct might be used.
8: protected class Center
9: {
10: int x;
11: int y;
12: }
14: protected Center centerOfRoundShape = new Center();
15: protected double radiusOfRoundShape;
18: //Constructor
19: public RoundShape(int xCenter, int yCenter, double radius)
20: {
21: centerOfRoundShape.x = xCenter;
22: centerOfRoundShape.y = yCenter;
23: radiusOfRoundShape = radius;
24: }
27: //Example of an abstract method
28: abstract public double getArea();
29: //Such a method *must* be implemented in any derived class.
30: //Or, the derived class must itself be declared abstract.
31: }