Q:

ClassCastException vs. "inconvertible types" compilation error

So I wanted to know on what situations Java throws ClassCastException and when it's "inconvertible types" compilation error.  I guess it's something about interfaces. 
I mean with interfaces there is more difficult situation.  For example:
interface SomeInterface {}
class SomeClass {}
SomeClass someObject = new SomeClass();
SomeInterface someInterface  = (SomeInterface)someObject;

throws ClassCastException thought It's clear at compile time, that SomeClass object cannot be casted to SomeInterface. 

A:

It's not necessary about interfaces.  A cast tells the compiler that you're going to reference an instance of one type, from a variable of another type. 
When the type conversión suggested by the cast is impossible, you get a compilation error. 
i.e. String s = (String) new Integer(1);
When sometimes it's possible and sometimes not, the code compiles, but you may get a ClassCastException. 
i.e. 
Object o = ...;
String s = (String) o;//Depending on the content of o, this line may throw a ClassCastException

