aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Interface" Watch "Interface" New topic
Author

Interface

soujanya Bugatha
Greenhorn

Joined: May 29, 2012
Posts: 10
Is it possible to define a class inside an interface ? I read that we can declare public abstract methods and final variables inside an interface but i never came across any code which defines a class inside an interface. please explain me.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

you can define a class inside an interface. and this class is implicitly public static . in this way one can give a default implementation to clients(there are many other better way though).
Adriano Ribeiro
Greenhorn

Joined: Nov 16, 2012
Posts: 7
Can you give us an example? Thanks.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Adriano Ribeiro wrote:Can you give us an example?


Kevin Florish
Ranch Hand

Joined: Jan 06, 2009
Posts: 176
This is an interesting topic!

Being a devil's advocate here, maybe we could discuss the following quote from Seetharaman:

you can define a class inside an interface. and this class is implicitly public static . in this way one can give a default implementation to clients(there are many other better way though).


Interested in replies


Java5 Tutorials | Java6 Tutorials | HTML/CSS Tutorials | JavaScript and jQuery Tutorials
sharma ishu
Ranch Hand

Joined: Sep 10, 2012
Posts: 70
Kevin Florish wrote:This is an interesting topic!

Being a devil's advocate here, maybe we could discuss the following quote from Seetharaman:

you can define a class inside an interface. and this class is implicitly public static . in this way one can give a default implementation to clients(there are many other better way though).


Interested in replies

What does the "default implementation" mean here?
 
jQuery in Action, 2nd edition
 
subject: Interface