class SimpleThread extends Thread{
public void run(){                                     //重写run()方法
for (int i = 0; i < 3; i++){
System.out.println(getName()+i);                    //获得当前线程名称
try{
	 sleep((int)(Math.random() * 1000));              //线程休眠，进入中断状态
}catch (InterruptedException e) {                 //调用sleep()方法，必须进行异常捕获
System.out.println(e);
}
}
System.out.println("DONE! " + getName());
}
}
class Example10_1{
     public static void main (String args[ ]){
        SimpleThread one = new SimpleThread();
        one.setName("oneThread");                       //为线程one设定名字为oneThread
        one.start();                                     //启动线程，使线程进入等待队列
        SimpleThread two = new SimpleThread();
        two.setName("twoThread");                       //为线程two设定名字为twoThread
        two.start();
	}
}
