title: Java abstract method signature
body: <p>I am quite confused about abstract method signitures that Java classes implement.</p>
  
  <p>For example, consider:</p>
  
  <pre><code>interface Programmer {
      Object program();
  }
  
  class Linus implements Programmer {
      public String program() {
          return "goto end;";
      }
  }
  
  public class Main {
      public static void main(String[] args) {
          System.out.println(new Linus().program());
      }
  }
  </code></pre>
  
  <p>This is apparently acceptable, since anything expecting an Object to come from Linus.program() will get one (specifically, a String).</p>
  
  <p>But now consider this:</p>
  
  <pre><code>interface OS {
      void run(String code);
  }
  
  class Linux implements OS {
      public void run(Object code) {
          System.out.println("Hello world");
      }
  }
  
  public class Main {
      public static void main(String[] args) {
      new Linux().run("print 'Hello world'");
      }
  }
  </code></pre>
  
  <p>This fails to compile, and yields the error:</p>
  
  <pre><code>The type Linux must implement the inherited abstract method OS.run(String)
  </code></pre>
  
  <p>Now, anything could expected to be able to pass a String into any instance of the OS interface, and you could certainly do that with Linux.</p>
  
  <p>I see no reason why the second one fails to compile. Of the consequences of having Java compile the second program, am I missing something that makes this prohibitive?</p>