//parent interface
interface Showable{
void show();
static final class a{
static final int data=1;// we can create class inside interface
}
//child interface
interface Message{
void msg();
}
}
public class ShowInterface implements Showable.Message {
@Override
public void msg() {System.out.println("i am in nested interface ");
}
public static void main(String[] args) {
ShowInterface obj = new ShowInterface(); //obj :- a reference to parent interface
obj.msg();
}
}
OUTPUT
i am in nested interface
interface Showable{
void show();
static final class a{
static final int data=1;// we can create class inside interface
}
//child interface
interface Message{
void msg();
}
}
public class ShowInterface implements Showable.Message {
@Override
public void msg() {System.out.println("i am in nested interface ");
}
public static void main(String[] args) {
ShowInterface obj = new ShowInterface(); //obj :- a reference to parent interface
obj.msg();
}
}
OUTPUT
i am in nested interface
No comments:
Post a Comment