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 the difference between length and length () in java?

0 Answers  


How many types of exception can occur in a java program?

0 Answers  


What is variable length arguments in java?

0 Answers  


What is difference between core java and java ee?

0 Answers  


In real time project which driver did u use? What is the main functionality of the Prepared Statement?

3 Answers   Photon,






Is passing by reference faster?

0 Answers  


What are the three parts of a lambda expression? What is the type of lambda expression?

0 Answers  


Is it compulsory for a try block to be followed by a catch block in java for exception handling?

0 Answers  


What is style and indentation?

0 Answers  


Is null a keyword in java?

0 Answers  


Why we use static and synchronized in method for single thread model example: public static synchronized add(){}

2 Answers  


How does final modifier work?

1 Answers   Tech Mahindra,


Categories