创建儿子班以扩展父亲班
// 来自 NowJava.com class Father { int age; public void setage() { age = 75; } public int getage() { return age; } } class Son extends Father /* 来 自* 时 代 J a v a 公 众 号 - nowjava.com */ { int S_age; public void setage_S() { S_age = 45; } public int getage_S() { return S_age; } } class GrandSon extends Son { int GS_age; public void setage_GS() { GS_age = 15; } public int getage_GS() { return GS_age; } } class Multi_Level { public static void main(String args[]) { GrandSon obj = new GrandSon(); obj.setage(); obj.setage_S(); obj.setage_GS(); System