Created
May 17, 2018 01:39
-
-
Save sykwer/208e3db4c62a366ac2db78166690751b to your computer and use it in GitHub Desktop.
Multithread demo in Java.
This file contains 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
public class MultithreadDemo { | |
public static void main(String[] args) { | |
for (int i = 0; i < 10; i++) { | |
Task task = new Task(); | |
task.start(); | |
} | |
} | |
} | |
class Task extends Thread { | |
public void run() { | |
System.out.println("Thread: " + Thread.currentThread().getId() + " is running"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment