代码如下
- class sudu
- {
- public static void main(String[] args)
- {
- fu z = new zi();
- z.show();
- System.out.print(z.b);
- }
- }
- class fu
- {
- int d = 10;
- int b = 20;
- void show(){
- System.out.println("fu_show");
- }
- }
- class zi extends fu
- {
- int c = 50;
- int b = 60;
- void show(){
- System.out.println("zi_show");
- }
- }
复制代码
为什么运行结果是zi_show 20而不是zi_show 60????
|