Object Class in Java

Many of us knew that any class we create in Java by default it will be one of the Child Class of the Object Class.

Object class is not just plays the role of a super class for any class and also responsible for object locking, monitor entry and many more.

For now will see what are the methods associated with Object class

wait method of java.lang.Object

If wait method without arguments invokes or calls, Then current thread will be releasing a lock on the Object of a particular class and stops the execution of further proceeding. The execution of a thread stops until the notify() or notifyAll() method is invoked on that particular object. As mentioned earlier, wait method can only be called in synchronized block otherwise it will leads to java.lang.IllegalMonitorStateException