Write a Java program using TWO (2) threads and applying ReentrantLock:
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.
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.
Write a Java program using TWO (2) threads and applying
ReentrantLock
:Enter
button.The result of the calculation will be displayed after both thread have terminated.