public class Test { /** * @param args */ public static void main(String[] args) { GrandfatherTest a = new ChildTest(); System.out.print("==="); a.doPrint(); } } class ChildTest extends FatherTest { String childTest = null; ChildTest() { doPrint(); System.out.println("childTest:" + childTest); } void doPrint() { childTest = "child"; System.out.println("child"); } } class FatherTest extends GrandfatherTest { String fatherTest = null; FatherTest() { doPrint(); System.out.println("fatherTest:" + fatherTest); } void doPrint() { fatherTest = "fatherTest"; System.out.println("father"); } } class GrandfatherTest { String grandfatehrTest = null; GrandfatherTest() { doPrint(); System.out.println("grandfatherTest:" + grandfatehrTest); } void doPrint() { grandfatehrTest = "grandfather"; System.out.println("grandfather"); } }