class Shape { void draw() { System.out.println("Shape") ; } } class Rectangle extends Shape { void draw() { System.out.println("Draw Rectangle.") ; } } class Circle extends Shape { void draw() { System.out.println( "Draw Circle.") ; } } public class Poly { public static void main(String[] args) { Shape shapeObject = new Rectangle() ; //Which method gets called. // the one for the Shape or the one for the //Rectangle shapeObject.draw() ; } }