title: Return type of method that implements an interface
body: <p>I am curious to know what is the best practice / SE convention of handling return type of methods that implements an interface. Specifically, assume we are implementing a simple tree, with interface as such:</p>
  
  <pre><code>public interface ITreeNode {
      public ITreeNode getLeftChild();
      public ITreeNode getRightChild();
      public ITreeNode getParent();
  }
  </code></pre>
  
  <p>And we have a class TreeNode that implements that:</p>
  
  <pre><code>public class TreeNode implements ITreeNode {
      private TreeNode LeftChild, RightChild, Parent;
      @Override
      public ITreeNode getLeftChild() {
          return this.LeftChild;
      }
  
      @Override
      public ITreeNode getRightChild() {
          return this.RightChild;
      }
  
      @Override
      public ITreeNode getParent() {
          return this.Parent;
      }
  }
  </code></pre>
  
  <p>My question is.. should the return type of the respective implemented methods be ITreeNode or TreeNode, and why.</p>
  
  <p>Eclipse automatically populate the methods for TreeNode with return type of ITreeNode. However changing it to TreeNode doesn't cause any errors or warnings even with the @Override flag.</p>