Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About Interfaces and Classes

 
Siddharth Bhargava
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

manoja.
 
Siddharth Bhargava
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48954
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 . . .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic