package csdn.cn;
class Supershow{
static int y=8;
static int m=2;
void show() {
System.out.println("super.show, y="+y);
}
}
public class Add extends Supershow {
int y=20;
int z=1;
void show() {
System.out.println("Add.show, y="+y);
}
public static void main(String args[]) {
Add b=new Add();
Supershow a=b;
System.out.println(b.y);
System.out.println(a.y);
b.show();
a.show();
System.out.println("z="+b.z+",m="+b.m);
}
}
输出结果:
20
8
Add.show, y=20
Add.show, y=20
z=1,m=2