1.用super()方法调用父类中被覆盖的的方法
package test;
class Father
{
protected int num;
public void numAddOne()
{
System.out.println("父类的方法输出结果为 "+Integer.valueOf(num+1)) ;
}
}
class Son1 extends Father
{
public void numAddOne()
{
super.numAddOne();
System.out.println("子类的方法输出结果为 "+Integer.valueOf(num+2)) ;
}
}
public class TestSuper
{
public static void main(String args[])
{
Son1 son = new Son1();
son.numAddOne();
}
}