int  a2 = (int )o1; int  b2 = (int)o1;
try to cast o1 to two different, incompatible types. Only one of them can possibly succeed; these two types can't be interconverted. The first line succeeds, since o1 points to the original "a", which is indeed an int. Therefore the second line fails, because o1 is not an int.