GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes About Interfaces and Classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "About Interfaces and Classes" Watch "About Interfaces and Classes" New topic
Author

About Interfaces and Classes

Siddharth Bhargava
Ranch Hand

Joined: Feb 23, 2007
Posts: 266
I found out one interesting thing that we can have a class inside an interface and an interface inside a class. Please could anyone tell me the concept behind this. I am very confused. Please explain the concept with some practical example. Thanks a lot.
manoj sam
Greenhorn

Joined: Apr 06, 2007
Posts: 4
Hi,

You mean class defined in an interface, or class instances (variables) in an interface definition ?

manoja.
Siddharth Bhargava
Ranch Hand

Joined: Feb 23, 2007
Posts: 266
I mean class defined in an interface......for e.g.
public interface A
{
public class classX{

}
}

OR

public class X {
public interface A {

}
}
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Hi,

Welcome to JavaRanch!

Please don't post the same question to more than one forum; see our explanation here. I've deleted the other copy of this thread.


[Jess in Action][AskingGoodQuestions]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39076
    
  23
Find a copy of a book like Bruce Eckels' Thinking in Java (older editions legally available to download-try here), which has a chapter about inner classes in.

But don't expect it to be easy to understand . . .
 
Don't get me started about those stupid light bulbs.
 
subject: About Interfaces and Classes