Q:

Class Inheritance and Casting

So I was given this code in a folder of bits and pieces that were to be for a project which has since halted development. However, being new to Java there are several questions I have (and I'm  aware the code does not compile, but that works into one of my questions).
interface Executable { 
   public int execute (Object o); 
} 

public class Biv implements Executable { 

   public int execute (String s) { 
     System.out.println (s); 
     return s.length(); 
   } 

   public static void main (String[] args) { 
     Executable e = new Biv(); 
     System.out.println( 
         e.execute ("Hello World!")); 
   }

}

1) My first question is to do with the variable e. It is declared with the Executable object type, however I don't understand why it can then be instantiated with a new Biv object. What is going on here, what does it mean?
2) The error is in the execute method within the Biv class. This seems to be because it expects an object rather than a String. However, can you not replace a Object with a String because String is a subclass of Object? I could understand if you replaced String with Object it would have an error (I think) but not how it is currently done.

A:

I don't understand why it can then be instantiated with a new Biv
  object

Because Biv implements Executable, so any instance of Biv is also an instance of Executable.

The error is in the execute method within the Biv class

Yes it is, it [Biv] does not implement execute(Object). The method execute(String) is just a different method that happen to have the same name, since they don't have the same signature. Any class that implements the interface Executable must override the method execute(Object).
There is no co-variance of arguments in java for overriding methods, because it will be unsafe. What if you invoked e.execute(new Object())? [where e is referencing a Biv object] Biv will not know what to do with it.

