Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Container Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Container" Watch "Container" New topic


sean cee
Ranch Hand

Joined: Oct 24, 2000
Posts: 115
Which cannot be added to a Container?
a) Applet b) Component c)Container d) Panel
e) MenuItem or Menu or MenuComponent.
why is the answer e?
I think none is the answer.
or is the question supposed to be "cannot be directly added..."?
then answer e) sounds right....
I am confused.

Thanks heaps

Sean <br />SCJP2, SCJP2p1.4, SCWCD
Ranch Hand

Joined: Oct 20, 2000
Posts: 68
Hi Sean,
You will understand, if you go through thr' hierarchy.
The sub classes of MenuComponent are
Menu etc.
Here Super class is not "Container" hence you can not add
the above items to a Container.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
Wait a second here Component implements MenuContainer - inherited by Container. You can add a PopupMenu to any Component. The inheritance of Object->MenuComponent-> has nothing to do with it.
Only a Frame can have a MenuBar, maybe thats what the question was trying to get at.
Ranch Hand

Joined: Oct 20, 2000
Posts: 68
Hi William,
I thing the following explanation is ok.
Container itself is a component, button,applet and component are component. But menu extends MenuComponent which extends Object so it is not a component.
Hence Menu canot be added to a container.
If am wrong, correct me.

[This message has been edited by P SOLAIAPPAN (edited October 29, 2000).]
I agree. Here's the link:
subject: Container
jQuery in Action, 3rd edition