这里各位都是强头,我来列个例子//A.javaabstract class A{ public A(){ System.out.println("父类构造输出"); } }//B.javaclass B extends A{ B(){ super();//不管这行有没有都一样 System.out.println("子类构造输出"); }
public static void main(String[] args){ B b=new B(); } }子类的构造方法,并不会覆盖父类的构造方法,输出结果为父类构造输出 子类构造输出
I found one of the examples in api.public abstract class BodyContent extends JspWriter A JspWriter subclass that can be used to process body evaluations so they can re-extracted later on. BodyContent protected BodyContent(JspWriter e)Protected constructor. Unbounded buffer, no autoflushing.-------------------------------- The protected constructor seems to make an house keeping(clear the buffer,unbind some resouce,flush the new change,or commit sth)
public A(){
System.out.println("父类构造输出");
}
}//B.javaclass B extends A{
B(){
super();//不管这行有没有都一样
System.out.println("子类构造输出");
}
public static void main(String[] args){
B b=new B();
}
}子类的构造方法,并不会覆盖父类的构造方法,输出结果为父类构造输出
子类构造输出
extends JspWriter
A JspWriter subclass that can be used to process body evaluations so they can re-extracted later on.
BodyContent
protected BodyContent(JspWriter e)Protected constructor. Unbounded buffer, no autoflushing.--------------------------------
The protected constructor seems to make an house keeping(clear the buffer,unbind some resouce,flush the new change,or commit sth)