• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Menu

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Component class implements the MenuContainer interface,why Frame class continue to implement the MenuContainer interface.I think Frame extneds from Component class,it automatically have the property of MenuContainer.So the other subclasses of Compoent can add Menu in their container.True of False.Why?
Thank you.
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
IMHO the best answer (by maha anna)is here
 
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maha Anna's post gives an explanation for the specific case of menus, but can anybody give a more general explanation? I'll rephrase the question:
What is the point of implementing an interface in a subclass when a superclass has already implemented that interface?
I've seen this construct used in other places in the core library. For instance, <code>AbstractList</code> implements the <code>List</code> interface and so do <code>ArrayList</code> and <code>LinkedList</code>, both of which inherit from <code>AbstractList</code>. Here's another example from the Collections API - <code>AbstractMap</code> implements <code>Map</code> and so do <code>HashMap</code> and <code>WeakHashMap</code>.
In all 3 of these examples (counting the menu classes), the topmost implementor is <code>abstract</code> and the subclasses are not. Does this have something to do with it?
jply
 
Shiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic