Friday, 18 March 2016

Can an Interface have an inner class ?


Yes !

Example
public interface Abc {
  static int i=0;
  void dd();

  // class starts
  class a1 {
    a1()  {
      int j;
      System.out.println("inside");
    }
    public static void main(String a1[ ])  {
      System.out.println("in interfia");
     }
  }
}

No comments:

Post a Comment

Note: only a member of this blog may post a comment.