package com.lovecoding.day14.ex02;

public class TestRacer {
    public static void main(String[] args) throws InterruptedException {

        Racer racer1 = new Racer(100,10000);
        Racer racer2 = new Racer(1000,1000);

        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                racer1.run1();
            }
        });
        Thread t2 = new Thread(new Runnable() {
            @Override
            public void run() {
                racer2.run1();
            }
        });

        t1.start();
        t2.start();

        //要等兔子和乌龟的线程结束，主线程（裁判）才能公布最后的结果。
        t1.join();
        t2.join();

        System.out.println("兔子"+racer1.getTime());
        System.out.println("乌龟"+racer2.getTime());


    }
}
