Hi Ratul..., here is the code :
class A {
private interface X {
void f();
}
public class B implements X {
public void f() {
System.out.println("implements Private Interface");
}
}
public X getX() { return new B(); }
private X xRef;
public void receiveX(X x) {
xRef = x;
xRef.f();
}
}
public class NestingInterface {
public static void main(
String[] args) {
A a = new A();
a.receiveX(a.getX());
}
}
Note :
thing's to remember, creating Private interface is allowed ONLY inside class, you can not creating private interface inside another interface, because everything inside interface are implicitly public.
method : public & abstract
field : public, static, & final
hope that helps
stevie