How to write the inner class inside the interface?
public interface MyInterface {
class InsideInter{
int i=9, j=10;
public int add(int i,int j){
int tot=0;
tot=i+j;
return tot;
}
}
}
public class TestInterface implements MyInterface {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
TestInterface ti=new TestInterface();
MyInterface.InsideInter insider=new MyInterface.InsideInter();
System.out.println(insider.add(20, 25));
}
}
public interface MyInterface {
class InsideInter{
int i=9, j=10;
public int add(int i,int j){
int tot=0;
tot=i+j;
return tot;
}
}
}
public class TestInterface implements MyInterface {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
TestInterface ti=new TestInterface();
MyInterface.InsideInter insider=new MyInterface.InsideInter();
System.out.println(insider.add(20, 25));
}
}
0 comments: