diff --git a/src/com/pycat/multi/Main.java b/src/com/pycat/multi/Main.java new file mode 100644 index 0000000..0bf4aa0 --- /dev/null +++ b/src/com/pycat/multi/Main.java @@ -0,0 +1,28 @@ +package com.pycat.multi; + +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; + +/** + * Created by cat on 2018/8/13. + * + * @implNote who you are + */ +public class Main { + + public static void main(String[] args) { + ThreadFactory factory = Executors.defaultThreadFactory(); + Thread th = factory.newThread(() -> { + + for (int i = 0; i < 10; i++) { + System.out.print("Nice! "); + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + }); + th.start(); + } +} diff --git a/src/com/pycat/multi/package-info.java b/src/com/pycat/multi/package-info.java new file mode 100644 index 0000000..6e6d387 --- /dev/null +++ b/src/com/pycat/multi/package-info.java @@ -0,0 +1,5 @@ +/** + * Created by cat on 2018/8/13. + * code for 《图解Java多线程设计模式》 + */ +package com.pycat.multi; \ No newline at end of file