Example of Polymorphism

public class Point extends Shape {

        //override abstract method getName to return “Point”

        public String getName() {

                return “Point”; }

        public String toString() {

                return getX() “+” getY(); } }

public class Circle extends Point {

        private double radius;

        …constructor, set/get radius, diameter, etc.. //override getArea

        public double getArea() {

                return Math.PI * getRadius()*getRadius; } //override getName

        public String getName() {

                return “Circle” } }