package com.Thread;import sun.rmi.runtime.Log;public class Thread0202 extends Thread { public void run() { Thread0201 t1 = new Thread0201(); Thread0201 t2 = new Thread0201(); // 使用Runnable接口創(chuàng)建線程 Thread one = new Thread(new Thread0201(), "one"); Thread two = new Thread(new Thread0201(), "two"); one.start(); two.start(); // 為什么start一開(kāi)始 下面的命令不會(huì)執(zhí)行 而且廝殺過(guò)程一直不會(huì)停止 try { Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } t1.i = false; t2.i = false; try { two.join(); } catch (InterruptedException e) { e.printStackTrace(); } } public static void main(String[] args) { new Thread0202().start(); }}
求大神指教
qq電子時(shí)代
2016-04-19 14:18:20