Question: i want code within an hour please Write a Java multi-threaded program to simulate multiple people passing through a grotto (small cave) in search of

i want code within an hour please
Write a Java multi-threaded program to simulate multiple people passing through a grotto (small cave) in search of a magical box containing treasures. This grotto can only pass one person at a time, and the time for each person takes 3 seconds (sleep) to pass through it. There are seven persons, all of them try to pass through the grotto. Each person is associated with the name represented by the string and the name of the person who passes the grotto is printed out each time. There are 'n' boxes, each box will be identified by a unique integer value and one of them is a magical box that is identified by a prime number. The grotto will instantly close if any person finds the magical box. Create appropriate threads that replicate the scenario described using interthread communication. Incorporate wait() and notify() of thread class methods and introduce sufficient sleep() to simulate the above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
