Last active
March 26, 2019 13:13
-
-
Save Yatharth0045/a8826d20ff04be568585d4b41f3fd917 to your computer and use it in GitHub Desktop.
This program shows the execution of ExecutorService class.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Threads { | |
public static void main(String[] args) { | |
ExecutorService service = Executors.newFixedThreadPool(2); | |
for(int count = 0; count < 10; count++){ | |
service.execute(()->{ | |
System.out.println("Child Thread" + Thread.currentThread().getName()); | |
}); | |
} | |
service.shutdown(); | |
System.out.println("|Main Thread|"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment