title: Java casting in interfaces
body: <p>Can someone please explain to me how the compiler does not complain in the first casting, but does complain in the second?</p>
  <pre><code>interface I1 { }
  interface I2 { }
  class C1 implements I1 { }
  class C2 implements I2 { }
  
  public class Test{
       public static void main(String[] args){
          C1 o1 = new C1();
          C2 o2 = new C2();
          Integer o3 = new Integer(4);
  
          I2 x = (I2)o1; //compiler does not complain
          I2 y = (I2)o3; //compiler complains here !!
       }
  }
  </code></pre>