• 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
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Container

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Came across an intresting question in some mock can anybody pls explain the ans.
According to me it should be menu
Which cannot be added to a Container?
an Applet
Component
Container
Menu
Panel
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One of the add() methods defined in the Container class has the following signature.
Component add(Component comp)
Adds the specified component to the end of this container.
http://java.sun.com/j2se/1.3/docs/api/java/awt/Container.html
Since Menu is not a type of Component. (i.e. Menu doesnot inherit from Component, inherits from MenuComponent), it cannot be used to invoke the add() method of Container class, hence cannot be added to a Container.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic