Skip to content

Instantly share code, notes, and snippets.

@sykwer
Created May 17, 2018 01:39
Show Gist options
  • Save sykwer/208e3db4c62a366ac2db78166690751b to your computer and use it in GitHub Desktop.
Save sykwer/208e3db4c62a366ac2db78166690751b to your computer and use it in GitHub Desktop.
Multithread demo in Java.
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