Why wait() and notify() are always called from Synchronized context?
Hello guys, multithreading and concurrency are some of the most important topics for Java interviews and a good knowledge of them goes a long way in receiving a good offer.
In the past few posts, I have shared popular Java interview questions like How ConcurrentHashMap work in Java? Why String is Immutable and What is the difference between List, List<Object> and today, I am going to share another popular Java multithreading interview question, why wait() and notify() methods are called in synchronized context?
From synchronized context, I mean from a synchrnonized method or a synchronized block.
But before that let’s find out what is wait() and notify() method in Java and why are they improtant?
Keep reading with a 7-day free trial
Subscribe to Javarevisited Newsletter to keep reading this post and get 7 days of free access to the full post archives.