文选流氓 发表于 2003-2-5 12:04

1-1-4-10 main函数中不能直接new线程的问题

发信人: KHP (人之初), 信区: Java      
标题: Re: How do thread communicate with each other?
发信站: BBS 水木清华站 (Fri Jul2 23:29:29 1999)

【 在 networm (网虫) 的大作中提到: 】
:   Class ParentThread extends Thread {
:               .....
:         main()
:         {....
:               new ChildThread(this).start();
:               ...            
:         }
: Compile Error: this can't be used in the static method.
: why.????
别 why 了,错误信息不是说得很清楚吗?

可以这样:
ParentThread pthread = newParentThread();
(new ChildThread(pthread)).start();
页: [1]
查看完整版本: 1-1-4-10 main函数中不能直接new线程的问题