Java 创建子类对象的过程:
public class F511
{
private int ff=100;
protected int m=880;
F511()
{
m=add(8);
}
int add(int i){
return i+m;
}
public static void main(String args[]){
F511 f=new F511();
System.out.println("f="+f.m);
S511 s=new S511();
System.out.println("s="+s.m+" t= "+s.t);
}
}
class S511 extends F511
{
protected int ss=111;
S511(){
m+=ss;
t=add(9);
}
int add(int i){
return i*ss;
}
}