[java]
public class A {
int i;
}
子类代码:
[java]
public class B extends A{
int i;
B(int a,int b){
super.i=a;
i=b;
}
void show(){
System.out.println("i in superclass:"+super.i);
System.out.println("i in subclass:"+i);
}
}
测试类DemoSuper:
[java]
public class DemoSuper {
public static void main(String[] args) {
// TODO Auto-generated method stub
B b=new B(1,2);
b.show();
}