Skip to content

Instantly share code, notes, and snippets.

@nihat-js
Created December 11, 2023 20:47
Show Gist options
  • Save nihat-js/e43822134eb9b4b3b7144d47c1ff4979 to your computer and use it in GitHub Desktop.
Save nihat-js/e43822134eb9b4b3b7144d47c1ff4979 to your computer and use it in GitHub Desktop.
JavaThreadTest
public class ZombieThreadTester {
public static void main(String[] args) {
Thread[] threads = new Thread[100];
for (int i = 0; i < 100; i++) {
threads[i] = new Thread(new MyRunnable(i));
}
for (int i = 0; i < 100; i++) {
threads[i].start();
}
}
}
class MyRunnable implements Runnable {
private int index;
MyRunnable(int index) {
this.index = index;
}
@Override
public void run() {
System.out.println("running" + index);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment