日期:2014-05-20 浏览次数:20973 次
public class a1 {
    public static void main(final String[] args) {
        Thread m = new Thread(new Runnable() {
            public void run() {
                int j = 1;
                while (true) {
                    j++;
                    boolean b = Boolean.parseBoolean(args[0]);
                    if (b) {
                        System.out.println(b);
                        System.out.println(j);
                    }
                    if (j == 10) {
                        try {
                            System.out.println("j == 10:" + j);
                            Thread.sleep(3000);
                        } catch (InterruptedException e1) {
                            System.out.println("e1");
                        }
                    }
                }
            }
        });
        m.start();
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            System.out.println("e");
        }
        System.out.println("bbbbbbb");
        m.interrupt();
        System.out.println("ccccccc");
    }
}