File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

About Interfaces and Classes

Siddharth Bhargava
Ranch Hand

Joined: Feb 23, 2007
Posts: 268
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

Joined: Apr 06, 2007
Posts: 4

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

Siddharth Bhargava
Ranch Hand

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



public class X {
public interface A {

Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199


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

Joined: Oct 13, 2005
Posts: 46337
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 . . .
I agree. Here's the link:
subject: About Interfaces and Classes
It's not a secret anymore!