aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Advantages of Nesting Interfaces ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Advantages of Nesting Interfaces ?" Watch "Advantages of Nesting Interfaces ?" New topic
Author

Advantages of Nesting Interfaces ?

Murgan Sub
Greenhorn

Joined: Feb 06, 2002
Posts: 22
Have a look at this code below
interface E {
interface G {
void f();
}
interface H {
void f();
}
void g();

}
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
And?
What is exactly your question? Elaborate please.


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Murgan Sub
Greenhorn

Joined: Feb 06, 2002
Posts: 22
What are the advantages of nesting interfaces?
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
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 ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Advantages of Nesting Interfaces ?