What is update method and when it is called?

Answers were Sorted based on User's Feedback



What is update method and when it is called?..

Answer / raghuveer

update(Observable o,Object arg)
This method is called whenever the observed object is
changed. An application calls an Observable object's
notifyObservers method to have all the object's observers
notified of the change.
where:
o - the observable object.
arg - an argument passed to the notifyObservers method

Is This Answer Correct ?    17 Yes 6 No

What is update method and when it is called?..

Answer / mayank

The update() method is defined by the AWT and is
called when your applet has requested that a
portion of its window be redrawn. The problem is
that the default version of update() first fills
an applet with the default background colour and
then calls paint(). You can override the update()
method. The paint() in this case will simply call
update().

public void update(Graphic g) {
//Redisplay your window here.
}

public void paint(Graphics g) {
update(g); // call to the update()method.
}

Is This Answer Correct ?    10 Yes 0 No

Post New Answer

More Core Java Interview Questions

what is difference between colection and collections?

25 Answers   Amdocs, IBM, Infosys, Ipog Software, Polaris, Tech Mahindra,


What is the size of string?

0 Answers  


what are the methods in object?

0 Answers   IBS,


What is a package in java? List down various advantages of packages.

0 Answers  


Is map ordered in java?

0 Answers  


What is the difference between math floor and math round?

0 Answers  


What are the methods of object class ?

0 Answers  


How does queue work in java?

0 Answers  


where u use Abstraction and Interface in real time

3 Answers   Sonata,


What is java util concurrentmodificationexception?

0 Answers  


Explain the different forms of polymorphism?

0 Answers  


how to one war file class to another war file class?

0 Answers  


Categories