Friday, 17 February 2017

Inner & Nested Class : NestedInterfaceWithinClass





class ABC
{
    interface XYZ{
        void msg();    }

}
public class NestedInterfaceWithinClass implements ABC.XYZ{

    @Override    public void msg()
    {
        System.out.println( "Hi, This is nested interface within class." );    }
    public static void main(String[] args)
    {
        ABC.XYZ nestedInterface1 = new NestedInterfaceWithinClass();        nestedInterface1.msg();    }
}

No comments:

Post a Comment