waltermilner

Untitled

Jul 18th, 2019
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. public class Test implements Runnable {
  2.  
  3.   public static void main(String[] d) {
  4.     final int THREADCOUNT=100;
  5.     Test[] t = new Test[THREADCOUNT];
  6.     Thread[] th = new Thread[THREADCOUNT];
  7.     for (int index = 0; index < THREADCOUNT; index++) {
  8.       t[index]=new Test();
  9.       th[index] = new Thread(t[index]);
  10.       th[index].start();
  11.     }
  12.   }
  13.  
  14.   public void run() {
  15.     int z = 0;
  16.     for (long counter = 0; counter < 1000000000L; counter++) {
  17.       z++;
  18.     }
  19.    
  20.   }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment