• 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

Advantages of Nesting Interfaces ?

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at this code below
interface E {
interface G {
void f();
}
interface H {
void f();
}
void g();

}
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And?
What is exactly your question? Elaborate please.
 
Murgan Sub
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are the advantages of nesting interfaces?
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are very few examples of nested interfaces. A "well-known" one is for instance Map.Entry within interface Map (in java.util).
Some will say that nested classes (or interfaces) provide a better organization of your code and allow to avoid namespace pollution. It's more a matter of taste in my opinion.
Inner class Spec:
http://java.sun.com/products/jdk/1.1/docs/guide/innerclasses/spec/innerclasses.doc.html
Inner class chapter from KM:
http://developer.java.sun.com/developer/Books/certification/certbook.pdf
Some articles on that topic:
http://www.javaworld.com/javaworld/javatips/jw-javatip50.html
http://c2.com/ppr/wiki/JavaIdioms/ImmutableInterface.html
http://www.dcs.ed.ac.uk/teaching/cs3/ipcs/APJ/apj9.pdf
[ February 11, 2002: Message edited by: Valentin Crettaz ]
reply
    Bookmark Topic Watch Topic
  • New Topic