创建线程的方法:
There are basically two main ways of having a Thread execute application code.
One is providing a new class that extends Thread and overriding its run() method.
The other is providing a new Thread instance with a Runnable object during its creation. In both cases, the start() method must be called to actually execute the new Thread.
扩展Thread
new Thread(){
public void run(){
System.out.println("Thread is running.");
}
}.start();
使用Runnable