class Father {
int age=10;
public static void f1()
{
System.out.println(“father static”);
}
public void f2()
{
System.out.println(“father method”);
}
}
class Son extends Father {
int age=11;
public static void f1()
{
System.out.println(“son static”);
}
public void f2()
{
System.out.println(“son method”);
}
}
public class Demo{
public static void main(String[] args) {
Father obj=new Son();
System.out.println(obj.age);
obj.f1();
obj.f2();
}
}
输出--------
10-------父类
father static----父类
son method-----子类