方法的覆盖java

package jicheng.a;

class person{

    void fly()

    {

        System.out.println("你会飞吗");

    }

}

class st extends person{

    void fly()

    {

        System.out.println("起码比你好一点");

        super.fly();

    }

}

public class fugai {

    public static void main(String[] args) {

        // TODO Auto-generated method stub

       st p=new st();

       p.fly();

    }

}

猜你喜欢

转载自blog.csdn.net/zhouzhou_98/article/details/81173775
今日推荐