You have join the t1 to main
显示100.跟j=100在哪里没关系。new s()的时候j=100就被走到了。
显示100.跟j=100在哪里没关系。new s()的时候j=100就被走到了。
解决方案 »
- Java获取时间和本机时间不同?
- 整型二维数组赋值给多个textfield
- 急求高手解决一个GUI连接数据库小程序
- 一个简单的编程,请大家帮一下忙
- 把Frame改成JFrame,为什么监听器就不好用了?
- java.lang.ClassNotFoundException:oracle.jdbc.driver.OracleDriver
- 安装netbeans IDE 7.3.1是的问题
- applet访问服务器上的静态数据有哪些方法?
- 懂Hilbert图的人进来!——不懂也来看啊!
- 刚才的贴子没了???哪里有UML书籍下载!
- 请问http://china-programer.myrice.com为什么进不进去?
- 检测语句错误
j=0,这时主线程让出,开始进行run(),然后线程睡眠5秒,在此其间,没有别的线程中断该线程,所以不会产生异常,所以j不会等于100
对了,我还不知道答案是什么呢,我说的对不?
我也认为答案是2。
coz 1:the two threads here have the same priority, so the main thread has right to run first than the t1.
2.when main thread running first, j is still 100, the only way to let main to give up s suspend or yield.
any further discuss is welcomed .