With respect to multithreading, synchronization is the capability to control the access ofmultiple threads to shared resources. Without synchronization, it is possible for onethread to modify a shared
Latest Answer : Synchronization is the mechanism that ensures that only one thread is accessed the resources at a time. In a practical point of view assume that two threads are trying to update bank balance at the same time!!! How we can solve this issue the answer is sychronization. ...
Yes, a lock can be acquired on a class. This lock is acquired on the class's Class object..
Latest Answer : Aditya Pls write code and explain ...
An object's finalize() method cannot be invoked by the garbage collector while the objectis still reachable. However, an object's finalize() method may be invoked by otherobjects.
Latest Answer : No, reachable obejcts can not be garbage collected ...
An object's finalize() method may only be invoked once by the garbage collector.
Latest Answer : What if in the finalize method I make the object reachable.class a{ b b1=null; ..}class b{ a a1=null; ...
The wait(),notify(), and notifyAll() methods are used to provide an efficient way forthreads to wait for a shared resource. When a thread executes an object's wait() method, itenters the waiting state.
Latest Answer : wait() will move the thread to sleep state allowing for the other thread to execute. notify() will trigger back the wait() thread to ready state and to execute further. notifyAll() will trigger all wait() threads to ready state. Later, it will ...
An object's lock is a mechanism that is used by multiple threads to obtain synchronizedaccess to the object. A thread may execute a synchronized method of an object only afterit has acquired the object's
If a thread attempts to execute a synchronized method or synchronized statement and isunable to acquire an object's lock, it enters the waiting state until the lock becomesavailable.
The Class class is used to obtain information about an object's design.
Latest Answer : Java Reflection APIs gives the design information of an object ...
The garbage collector invokes an object's finalize() method when it detects that the objecthas become unreachable.
A thread can enter the waiting state by invoking its sleep() method, by blocking on I/O,by unsuccessfully attempting to acquire an object's lock, or by invoking an object's wait()method. It can