第三:线程常用方法
1.获取线程名称:getName();
2.取得当前线程对象:currentThread();
3.判断是否启动:isAlive();
4.强行运行:join();
5.线程休眠:sleep();
6.线程礼让:yield();
1.获取线程名称:getName();
2.取得当前线程对象:currentThread();
3.判断是否启动:isAlive();
4.强行运行:join();
5.线程休眠:sleep();
6.线程礼让:yield();
2015-10-10
RunnableDom d2 = new RunnableDom("e");
Thread t1 = new Thread(d1);
Thread t2= new Thread(d2);
t1.start();
new Thread(t2).start(); //这也是一种调用
Thread t1 = new Thread(d1);
Thread t2= new Thread(d2);
t1.start();
new Thread(t2).start(); //这也是一种调用
2015-10-10