public class Demo {
public static void main(String[] args) {
new Thread(){
//重写run()方法
@Override
public void run() {
System.out.println("a");
}
}.start();
new Thread(new Runnable(){
@Override
public void run() {
System.out.println("b");
}
}){}.start();
new Thread(new Runnable(){
@Override
public void run() {
System.out.println("c");
}
}){
//重写run()方法
@Override
public void run() {
System.out.println("d");
}
}.start();
}
}
|
|