This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes OO, Patterns, UML and Refactoring and the fly likes Class inside interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Class inside interface" Watch "Class inside interface" New topic
Author

Class inside interface

Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 755
Hi,

I came to know that we can declare class inside an interface...

So i was wondering what is the use of declaring class inside an interface ???

Basically interface defines the contact between the class implementing the interface..


Jigar Naik


Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
The only difference between a top level class and a class defined in an interface is the different namespace. It's used very seldomly, but if it's used at all, then typically to communicate that the class is very tightly coupled to the interface.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
It's not supposed to be used. It's like appendix of human, I believe.

If I've time, I'll come up with more technical answer.


SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Class inside interface