Can any one explain how this compiles:
COnsider the following classes/interfaces
interface Intf10{}
class Base1010 implements Intf10{}
Base1010 b10 = new Base1010();
Runnable r2 =(Runnable)b10; <--- How does this compile
Also, this
Object 0 = new Object()
Runnable r3 =(Runnable)0;
My understanding is that since both Base1010 abd Object do not implement the Runnable interface at all, they should not compile.
But it does.It was a different question if the interface handle
was Intf10.
I know that there will definitely be a runtime exception. But why no compile time ?
Any explaination.
Thanks.