title: What to return if a method returns an interface?
body: <p>I am given a set of interfaces and have to create a class that implements these interfaces, however, I am confused about the return type for the interfaces that have references to other interfaces. </p>
  
  <p>// Implement class C below so that the code compiles. None of the methods may return null.
      // You may define supplementary classes (inner-classes or "regular" classes) if you wish.
      // Note that C is a subclass of Object, and it implements only X and Y -- you cannot change this.</p>
  
  <pre><code>abstract class A {
  abstract void q ();
  }
  
  interface Y {
  int p (int j);
  A me ();
  }
  
  interface X {
  void m (Object o);
  X n ();
  }
  
  class C implements X, Y {
  // Write your code here -- make all methods public (otherwise,
  // the compiler will not consider the interfaces to be "implemented")!
  
      @Override
  public int p(int j) {
      // TODO Auto-generated method stub
      return 0;
  }
  
  @Override
  public A me() {
      // TODO Auto-generated method stub
      return null;
  }
  
  @Override
  public void m(Object o) {
      // TODO Auto-generated method stub
  
  }
  
  @Override
  public X n() {
      // TODO Auto-generated method stub
      return null;
  }
  }
  </code></pre>
  
  <p>What am I suppose to return for the methods that have an interface for a return type? I am confused because you can't instantiate interfaces so what am I suppose to return?</p>