Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on May 8th, 2011  |  syntax: Java  |  size: 0.68 KB  |  views: 106  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data