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

finalize() method?

5 Answers  


What does jenkins do?

0 Answers  


Explain the difference between serializable and externalizable in java?

0 Answers  


Why are global variables used?

0 Answers  


What is arrays aslist in java?

0 Answers  






Explain the difference between runnable and callable interface in java?

0 Answers  


What is method overloading in java ?

0 Answers  


What is the right data type to represent a price in java?

0 Answers  


What is the abstraction?

0 Answers  


Can you extend singleton class?

0 Answers  


What are synchronized methods ?

0 Answers  


Why does it take so much time to access an applet having swing components the first time?

0 Answers  


Categories