public class Demo5b { public static void main(String[] args) { GeometricObject a = new Rectangle("red", 1, 2); // Upcasting System.out.println(a.getArea()); // Polymorphism ! // ************************************************************* // What happens when you cast a superclass to a WRONG subclass // ************************************************************* Circle b; b = (Circle) a; // Cast superclass (GeometricObject a) to subclass // NO compile error: it is allowed // BUT you will get a RUNTIME error System.out.println(b.getRadius()); } }