• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

naming of an interface  RSS feed

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how come an interface can have a name like "Map.Entry"!!!??
(this is an interface in Collection framework... )


sajid
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sajid,

Entry is static nested interface, inside interface Map.
This is almost like a static-nested class inside a class.

Consider the following code:


You can reference this via Outer.Inner, and even instantiate an object of an anonymous inner class, for example:


Simply put, a static nested interface behaves similarly to a static nested class - except it is an interface. (Technically it is not an "inner"-interface, just as static nested classes are not "inner"-classes).

Regards,
Glen
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!