This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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
 
Don't get me started about those stupid light bulbs.
 
subject: component on applet : from majji exam
 
Similar Threads
Buttons
applet&buttons
awt
AWT
Question about Layout Managers