class A{
public static void testP(){
System.out.println("A");
}
public void testM(){
System.out.println("X");
}
}
class B extends A{
public static void testP(){
System.out.println("B");
}
public void testM(){
System.out.println("Y");
}
}
public class Test{
public static void main(String[] args){
A a=new A();
B b=new B();
a.testP();//结果是 A
b.testP();//结果是 B
a.testM();//结果是 X
b.testM();//结果是 Y
a=b;
a.testP();//结果是 A
b.testP();//结果是 B
a.testM();//结果是 Y
b.testM();//结果是 Y
}
}