作者wu110011 (不下棋)
看板java
標題[問題] Thread Debug問題
時間Wed Mar 9 20:32:20 2016
IDE是Eclipse,語言是JAVA,Release下執行,
a的結果是5,確定是有至run()函式中執行,可是在Debug模式下,
卻無法跳至run()函式中,似乎 跟mthread.join();這行有關,
請問有人知道為什麼嗎?
public class mythread implements Runnable{
public static int a = 0;
public void run() {
for (int k = 0; k < 5; k++) {
a = a + 1;
}
}
public static void main(String[] args) throws Exception {
Runnable r = new mythread();
Thread mthread = new Thread(r);
mthread.start();
mthread.join();
System.out.println(a);
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 106.1.105.79
※ 文章網址: https://www.ptt.cc/bbs/java/M.1457526743.A.877.html
→ cowbaying: 去設定到中斷點? 03/11 09:29
→ dream1124: 程式沒問題啊,你是不是有中斷點在run裡面中斷了執行緒 03/11 23:10
→ lane9449: 好像中斷點沒設好 03/14 07:26