Can we create a interface within interface ?If Yes then give an example .How we can call inner interface?

Can we create a interface within interface ?If Yes then give an example .How we can call inner interface?

Yes! We can create inner interface .We can call inner interface as <Outer call name>.<Inner Class Name> e.g. TestR4R.R4R


public
interface TestR4R {

// A no abstract methods can be public,final,static, must be initialized .

static int a = 0;

// only public & abstract

void method2();

interface R4R{

public void method1();

//We can declare same method name

public void method2();

}

}

class Test implements TestR4R ,TestR4R.R4R{

@Override

public void method2() {

}

@Override

public void method1() {

// TODO Auto-generated method stub

}

}

Read More →