Cognizant Interview Question

Producer consumer problem, Java concepts