title: Casting an Object to an Interface
body: <p>i have the following Classes and interfaces:</p>
  
  <pre><code>public interface if1 {}
  public class ifTest implements if1 {}
  
  public class HelloWorld {
       public static void main(String[] args) {
            //why does the following cast not work (Compiler error)  
            ifTest var3 = (if1) new ifTest();
       }
  }
  </code></pre>
  
  <p>Why does this cast not work? I get the following compile error: "Type mismatch: cannot convert from if1 to ifTest"</p>