• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Boone Mock1 #40

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the question
What statements about paint() method is true;
a)It is protected.
b)takes an instance of class Graphics.
c)it is static.
d)automatically called when you minimize and maximize a component such as a window.
e)has a version that takes an int as a parameter.
I picked b,d.
The answer given in the book is C.
Can someone clarify this.
Thanks in advance.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its b only when the window is minimized or maximized or some part of window is covered or uncovered repaint method is invoked from repaint method update method is invoked.Not panit method is invoked automatically.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think b and d are correct. Option 'c' paint() method is static is certainly wrong.
paint method is defined in Component class as
public void paint(Graphics g);
I think this Question should be moved to errata.
cheers
Sankar
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
repaint() calls update() that calls paint(). That is the sequence. So d is not correct.
Ram
 
reply
    Bookmark Topic Watch Topic
  • New Topic