We know order of running of two different thread is not in our hand by default but somewhere we need to control the order of running. So I tried to demonstrate inter thread communication by using
Semaphore. This Java program prints odd & even numbers in sequential fashion using two different threads. It means one thread generates odd numbers and another thread generate even numbers.
Continue reading How to Print Odd and Even Number by Thread using Semaphore