@Paul
See if the code line was
Then there are no issues.This code will compile and run fine but in the scenario which i described is different. Here the class TestInterfaceImpl does not extends TestClassCast, just implements the TestInterface. Here it is obvious that at runtime a class cast exception will be thrown but compiler does not complain at compile time. My question is that why does compiler still allows typecasting when it is evident that TestClassCast is unrelated to TestInterface(Does not implement it).If I make the TestClassCast final the compiler *does* report a compilation error. Just because of the possibility that there could be a child class of TestClassCast which also implement TestInterface?
Thanks,
Asit