STIW3054-A172 / Main-Issues

1 stars 1 forks source link

Exercise_16 #17

Open zhamri opened 6 years ago

zhamri commented 6 years ago

Write a Java program using TWO (2) threads and applying ReentrantLock:

  1. Thread-1 to count 500 evan numbers starting from 20. If the total of the numbers equal to or greater than 100, then the thread will wait until Thread-2 finish.
  2. Thread-2 to count 500 odd number starting from 30. If the total of the numbers greater than 100, then the program will prompt to a user for pressing Enter button.

The result of the calculation will be displayed after both thread have terminated.