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 stop(), suspend() and resume() methods have been deprecated in JDK 1.2.
Latest Answer : Please Stop using JAVA 1.2 Coz there are many methods which are deprecated in Java 1.4. For thread stop, suspend are deprecated in JAva 1.4 ...
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. ...
Name three subclasses of the Component class.Box.Filler, Button, Canvas, Checkbox, Choice, Container, Label, List, Scrollbar, orTextComponent
It must provide all of the methods in the interface and identify the interface in itsimplements clause.
Latest Answer : interface enhance the concepts of inheritence. by calling multiple interfaces to class we can also inherinting more than a class indirectly ...
The start() method of the Thread class is invoked to cause an object to begin executing asa separate thread.
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 ...