1, runnable is an interface, when the implementation of the interface needs to re-use the Run method, in the Run method to implement its own logic.
2, Thread is a class, it actually implements the Runnable method, that is to say, when you get a thread instance through the new thread, you actually rewrite the runnable inside the Run method. When you create a thread instance by implementing Runnable, you need to pass the runnable instance a thread, and then open it through. Start.
3, runnable can thread synchronization, but thread is not synchronized with threads, such as a total of 10 tickets, you can open 3 threads at the same time to sell tickets, if you inherit thread to create a ticket class, instantiate 3 threads will each sell 10 tickets, altogether sold 30 cards, At that time, by implementing the ticket-selling class created by runnable, you only need to instantiate an object, pass an object to three thread, and then turn on three threads, and you will find that three threads will only sell 10 of them.
Runnable and Thread