七月推薦系統(tǒng)實(shí)戰(zhàn) 第二期
// 最終結(jié)果不是 1000public class Test {
? ?private static int j = 0;
? ?public static void main(String[] args) {
? ? ? ?for (int i = 0; i < 1000; i++) {
? ? ? ? ? ?new Thread(() -> {
? ? ? ? ? ? ? ?try {
? ? ? ? ? ? ? ? ? ?Thread.sleep(1);
? ? ? ? ? ? ? ?} catch (InterruptedException e) {
? ? ? ? ? ? ? ? ? ?e.printStackTrace();
? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ?System.out.println(++j);
? ? ? ? ? ?}).start();
? ? ? ?}
? ?}}
標(biāo)簽: