1、//以下为示例class A { protected void print(String s){罕铞泱殳 System.out.println(s); } public void f() {print("A:f()");} A(){print("A()");}}class B extends A{ //继承中没有super则默认调用基类的无参数的构造方法 //为什么这里调用的是A()而不是f(),因为f()并不是“构造”方法 B(){print("B()");} public void f(){print("B:f()");} public static void main(String[] args) { B b = new B(); b.f(); }}/*输出结果为: A() B() b.f() */