jQuery in Action, 2nd edition*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes component on applet : from majji exam Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "component on applet : from majji exam " Watch "component on applet : from majji exam " New topic
Author

component on applet : from majji exam

geetha nagarajan
Ranch Hand

Joined: Jul 13, 2001
Posts: 94
In the following applet, how many Buttons will be displayed?

A) 1 Button with label "Ok" and 1 Button with label "Cancel" .
B) 1 Button with label "Ok" and 4 Buttons with label "Cancel" .
C) 4 Buttons with label "Ok" and 1 Button with label "Cancel" .
D) 4 Buttons with label "Ok" and 4 Buttons with label "Cancel" .
The answer given is :B.
Is it bcos ,the init() is called only once ???
Pl.clarify.
[ June 06, 2002: Message edited by: geetha nagarajan ]
Thiru Thangavelu
Ranch Hand

Joined: Aug 29, 2001
Posts: 219
B'cos only one instance of "Ok" button is created whereas 4 new instances of "Cancel" buttons are created.


Thanks,<br />Thiru<br />[SCJP,SCWCD,SCBCD]
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
As this code shows adding a component to a Container removes it from anyone in which was before. ;-)


SCJP2. Please Indent your code using UBB Code
 
 
subject: component on applet : from majji exam