Can anyone help me to implement the code for the following assignment:

There is a "box" where numbers are written. A thread named WriteThread writes a number to the box, while another thread ReadThread reads the number from the box.

Access to this box needs to be synchronized and any number written by WriteThread has to be read by ReadThread.

WriteThread cannot write the next number if the number is not read by ReadThread first and vice versa.

I appreciate any help.