java 多态的实质是  不同的对象实现相同的接口,调用接口提供的方法时 不用关心具体的对象是谁,只要它实现了该接口。
下面的示例中有五个类:
com.inf.Moveable
com.inf.Vehicle
com.Bike
com.Train
com.main.Client
package com.inf;

public interface Moveable
{
         public void run();
         public void stop();
}


package com.inf;

public abstract class Vehicle implements Moveable
{
         /***
         * the method is same , and Implement it only once
         * Access permissions : protected
         */

         protected void braking()
        {
                System.out.println( "braking");
        }

         /***
         * Empty implementation
         */

         public void run()
        {
        };

         /**
         * Empty implementation
         */

         public void stop()
        {
        };
}


package com;

import com.inf.Vehicle;

public class Bike extends Vehicle
{
        @Override
         public void stop()
        {
                 super.stop();
                 /**
                 *    in abstract class Vehicle
                 */

                braking();
                lean_wall();
        }

         private void lean_wall()
        {
                System.out.println( "Let the bike against the wall");
        }

        @Override
         public void run()
        {
                System.out.println( "use foot run bike");
        }

}


package com;

import com.inf.Vehicle;

public class Train extends Vehicle
{
        @Override
         public void stop()
        {
                 super.stop();
                 /**
                 *    in abstract class Vehicle
                 */

                braking();
                poweroff();
        }

         private void poweroff(){
                System.out.println( "poweroff train");
        }

        @Override
         public void run()
        {
                System.out.println( "use electricity run train");
        }

}

package com.main;

import com.Train;
import com.inf.Moveable;

public class Client
{
         public static void main(String[] args)
        {
                Moveable m1= new Train();
                m1.run();
                m1.stop();
        }
}

Bike 和Train 是两个具体的交通工具,都实现了接口Moveable 中的两个方法:run() 和stop()。
所以在测试类 Client 中调用run和stop方法时使用的是 Moveable 对象,而不必关心到底是Bike还是Train。
问题是中间为什么还有增加一个抽象类 Vehicle 呢?
因为Bike和Train 有一个相同的动作(刹车)是相同的,既然是相同的,就应该仅仅实现一遍,所以把 Bike和Train 共有的方法都放在抽象类中实现,否则就要在 Bike和Train中分别实现一遍,造成代码的冗余。 Bike和Train中不同的部分就推迟到具体类(这里就是 Bike和Train )中实现。