Advertisement
Guest User

Untitled

a guest
May 8th, 2011
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1.  
  2. import java.util.Arrays;
  3. import java.util.Random;
  4.  
  5. public class Exercise3 {
  6.     public static Random random = new Random();
  7.    
  8.     public static void main(String[] args) throws InterruptedException {
  9.         final Account[] accounts = new Account[10];
  10.         for(int i = 0; i < accounts.length; i++) {
  11.             accounts[i] = new Account();
  12.         }
  13.        
  14.         Thread[] tests = new Thread[5];
  15.         //start some tests for our banking system
  16.         for(int i = 0; i < tests.length; i++) {
  17.             tests[i] = new BankingTest(accounts);
  18.             tests[i].start();
  19.         }
  20.        
  21.         for(int i = 0; i < tests.length; i++) {
  22.             tests[i].join();
  23.         }
  24.        
  25.         //print some statistics    
  26.         System.out.println(Arrays.toString(accounts));
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement