您的位置:首页 > 其它

5.5 用实现Runable的方式定义线程

2011-01-29 11:09 176 查看
p { margin-bottom: 0.21cm; }
定义方式

class

TestThead

implements

Runnable

/*extends
Thread */

{

public

void

run() {

int

index = 0;

while

(

true

)
{

System.

out

.println(

"run()"

+Thread.

currentThread

().getName()+index);

index++;

}

}

}

实例化
使用方式


Thread
testThead =

new

Thread(

new

TestThead());

testThead.start();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐