package com.idealisan.test; /**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println("a");
Runnable t=new Runnable() { public void run() {
System.out.println("aa");
try {
System.out.println(Thread.activeCount());
Thread.sleep(10000);
System.out.println(Thread.activeCount()); } catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("bb");
}
};
new Thread(t).start(); System.out.println("b");
Thread.currentThread().stop();
System.out.println("stopped");
}
}
10秒的睡眠时间绝对可以说明先后顺序了。并且强制stop线程也可以说明语句执行次序。