一、多线程简单用法
1、Thread
Thread thread1= new Thread() {
@Override
public void run() {
System.out.println("===Threading");
}
};
thread1.start();
Runnable (相当于Thread.run()那样并不能当多线程使用,详情分析:二、多线程之Thread中run 和start 区别 )
new Runnable(){
@Override
public void run(){
System.out.println("===Runnableing");
}
}.run();
2、Thread和Runnable
new Thread(new Runnable() {
@Override
public void run() {
System.out.println("===Thread and Runnableing");
}
}).start();