title: override the return type of method declared in the interface after its implemented in class
body: <p>My requirement is I have an Interface where one method is declared and two classes implement the same interface, in which one class has return type of <code>Set&lt;object type&gt;</code> and other <code>LIST&lt;object type&gt;</code>... please help me in correcting the code mistakes.</p>
  
  <p>Here is the example code below :</p>
  
  <p><strong>Report file</strong> --- interface </p>
  
  <pre><code>public interface Reportfile
  {
      public &lt;T&gt; parseReadfile();
  }
  </code></pre>
  
  <p><strong>Masterfile.java ---- class one</strong> </p>
  
  <pre><code>public class Masterfile implements Reportfile
      {
  Set&lt;Masterpojo &gt; mset = new TreeSet&lt;Masterpojo&gt;();
  
          public String[] newline = null;
          public Set&lt;Masterpojo&gt; parseReadfile()
              {
                  try{
                      Masterpojo mo = new Masterpojo();
                      CSVReader mread = new CSVReader(new FileReader(mfile),(delimiter));
                      while ((newline = mread.readNext()) != null)
                          {           
                              mo.setmline(newline);               
                              mset.add(mo);
                          }
                  }catch(Exception e)
                      {
                          log.error("file not found");
                      }
                  return mset;
              }
      }
  </code></pre>
  
  <p><strong>Transfile.java ---- class 2</strong> </p>
  
  <pre><code>public class Transfile implements Reportfile
      {
  
  List&lt;Transpojo&gt; tlist = new ArrayList&lt;Transpojo&gt;();
  
          public String[] newline = null;
  
          public List&lt;Transpojo&gt; parseReadfile()
              {
                  try{
                      Transpojo to = new Transpojo();
                      CSVReader tread = new CSVReader(new FileReader(Transfile),(delimiter));
                      while ((newline = tread.readNext()) != null)
                          {
                              to.settline(newline);   
                              tlist.add(to);
                          }
                  }catch(Exception e)
                      {
                          log.error("Transaction file not found");
                      }
                  return tlist;
              }
      }
  </code></pre>
  
  <p><strong>Masterpojo</strong></p>
  
  <pre><code>public class Masterpojo
      {
          public String[] mline = null;       
          public String[] getmline()
              {
                  return mline;
              }
          public void setmline(String[] mline)
              {
                  this.mline = mline;
              }       
      }
  </code></pre>
  
  <p><strong>Transpojo</strong></p>
  
  <pre><code>public class Transpojo
      {
  
          public String[] tline = null;
  
          public String[] gettline()
              {
                  return tline;
              }
          public void settline(String[] tline)
              {
                  this.tline = tline;
              }   
  
      }
  </code></pre>
  
  <p>I error like belo when I compile the code in cmd :</p>
  
  <pre><code>Masterfile.java:6: error: Masterfile is not abstract and does not override abstract method &lt;E&gt;parseReadfi
  le() in Reportfile
  public class Masterfile implements Reportfile
         ^
    where E is a type-variable:
      E extends Object declared in method &lt;E&gt;parseReadfile()
  Masterfile.java:34: error: parseReadfile() in Masterfile cannot implement &lt;E&gt;parseReadfile() in Reportfil
  e
                  public Set&lt;Masterpojo&gt; parseReadfile()
                                         ^
    return type Set&lt;Masterpojo&gt; is not compatible with void
    where E is a type-variable:
      E extends Object declared in method &lt;E&gt;parseReadfile()
  Transfile.java:7: error: Transfile is not abstract and does not override abstract method &lt;E&gt;parseReadfile
  () in Reportfile
  public class Transfile implements Reportfile
         ^
    where E is a type-variable:
      E extends Object declared in method &lt;E&gt;parseReadfile()
  Transfile.java:33: error: parseReadfile() in Transfile cannot implement &lt;E&gt;parseReadfile() in Reportfile
                  public List&lt;Transpojo&gt; parseReadfile()
                                         ^
    return type List&lt;Transpojo&gt; is not compatible with void
    where E is a type-variable:
      E extends Object declared in method &lt;E&gt;parseReadfile()
  4 errors
  </code></pre>