以后来写
public class Base
{
private String baseName = "base";
private int baseId = 10;
public Base()
{
callName();
}
public void callName()
{
System. out. println(baseName+baseId);
}
static class Sub extends Base
{
private String baseName = "sub";
private int baseId = 100;
public void callName()
{
System. out. println(baseName+baseId);
}
}
public static void main(String[] args)
{
Base b = new Sub();
}
}
结果:null0