萍聚社区-德国热线-德国实用信息网

 找回密码
 注册

微信登录

微信扫一扫,快速登录

查看: 752|回复: 0

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

[复制链接]
发表于 2003-2-5 13:04 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册 微信登录

x
发信人: KHP (人之初), 信区: Java      
标  题: Re: How do thread communicate with each other?
发信站: BBS 水木清华站 (Fri Jul  2 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 = new  ParentThread();
(new ChildThread(pthread)).start();
Die von den Nutzern eingestellten Information und Meinungen sind nicht eigene Informationen und Meinungen der DOLC GmbH.
您需要登录后才可以回帖 登录 | 注册 微信登录

本版积分规则

手机版|Archiver|AGB|Impressum|Datenschutzerklärung|萍聚社区-德国热线-德国实用信息网

GMT+2, 2024-9-21 03:31 , Processed in 2.967814 second(s), 21 queries , MemCached On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表