title: Is this casting allowed in Java?
body: <p>Say I have a interface:</p>
  <pre><code>public interface Foo
  {
  
  }
  </code></pre>
  <p>and a base class</p>
  <pre><code>public class Baseclass
  {
  
  }
  </code></pre>
  <p>and the following subclass</p>
  <pre><code>public class Subclass extends Baseclass implements Foo
  {
  
    public SubClass(BaseClass base)
  
  {
     super(base); // call copy constructor
  
     // initiatize subclass specific variables
  
  }
  
  }
  </code></pre>
  <p>Assuming I have an instance of subclass and I pass it to a method that accepts <code>Baseclass</code>, am I allowed to cast the <code>Baseclass</code> to <code>Foo</code> even though the base class itself doesn't implement the interface?</p>
  <pre><code>Foo foo = (Foo) Baseclass; // is this allowed?
  </code></pre>