//第一种:
new Thread(){
public void run(){
System.out.println("haha");
}
}.start();
//第二种:
new Thread(new Runnable(){
@Override
public void run() {
// TODO Auto-generated method stub
System.out.println("heihei");
}
}).start();
//第三种:
new Timer().schedule(new TimerTask(){
public void run(){
System.out.println("hehe");
}
}, 10);
//第四种:
Executors.newSingleThreadExecutor().execute(new Runnable(){
@Override
public void run() {
// TODO Auto-generated method stub
System.out.println("gaga");
}
});
new Thread(){
public void run(){
System.out.println("haha");
}
}.start();
//第二种:
new Thread(new Runnable(){
@Override
public void run() {
// TODO Auto-generated method stub
System.out.println("heihei");
}
}).start();
//第三种:
new Timer().schedule(new TimerTask(){
public void run(){
System.out.println("hehe");
}
}, 10);
//第四种:
Executors.newSingleThreadExecutor().execute(new Runnable(){
@Override
public void run() {
// TODO Auto-generated method stub
System.out.println("gaga");
}
});