Objects that subclass the Observable class maintain a list of observers. When anObservable object is updated it invokes the update() method of each of its observers tonotify the observers that it has changed
Latest Answer : Observer observe only those class which are Observable. ...
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 : As your might already know, any synchronisation needs an object (monitor) to acquire lock one. See below for the three different types on how to synchronise code.public class A{ // A monitor object of sycnhronising piece of code. private ...
The purpose of finalization is to give an unreachable object the opportunity to performany cleanup processing before the object is garbage collected.
Latest Answer : Java provides a method called finalize( ) that you can define for your class. Here’s how it’s supposed to work. When the garbage collector is ready to release the storage used for your object, it will first call finalize( ), and only on the next garbage-collection ...
Latest Answer : Menu class is the immediate super class of MenuItem.MenuBar is the immediate super class of Menu.Frame is the immediate super class of MenuBar. ...
The start() method of the Thread class is invoked to cause an object to begin executing asa separate thread.
A Canvas object provides access to a Graphics object via its paint() method.
No, an object cannot be cast to a primitive value.
Latest Answer : Ys its possibleByte b = new Byte("28"); double dd = b.doubleValue(); ...
A non-static inner class may have object instances that are associated with instances ofthe class's outer class. A static inner class does not have any object instances.
Latest Answer : The static inner classes can be accessed with out creating it's objects or we can access static inner classes with direct class name but in the case of non-static inner classes access we have to create the object of that class. ...
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