The PingPong algorithm is very simple
if my turn {
update whose turn is next
ping/pong - log the hit
notify other threads
} else {
wait for notification
}
Let's take an example and see how this works! Here is our Player class, which implements Runnable and takes in the access to the shared resource and a message