多态的编译,成员变量,运行编译看左边,成员方法运行看右边
package com.ZZ.z1;
class Fu {
int num = 4;
void show() {
System.out.println("showFu");
}
}
class Zi extends Fu {
int num = 5;
void show() {
System.out.println("showZi");
}
}
class T {
public static void main(String[] args) {
Fu f = new Zi();
Zi z = new Zi();
System.out.println(f.num);
System.out.println(z.num);
f.show();
z.show();
}
}