System.out.println("A's version of getAttr returns: " + new A().getAttr()); System.out.println("B's version of getAttr returns: " + new B().getAttr()); A c = new B(); System.out.println("C's version of getAttr returns: " + c.getAttr());