A small correction to the previous answer.
I2 i2=(I2)i1; since casting given it's fine
A cast is also checked during compile time. If the classes dont have any common subclas then it is a compile type error. However in the above case since I1 and I2 have a common subclass in C3, the cast is allowed.
Take a look at this example. This will result in a compile time error.
Hope this helps