> > I'm not sure about the answer to question#24 in the rules round up game. It > is as follows: > > Q: Class Y is a subclass of class X. Will this compile? Y myY=new X()? > > Ans: No > > Is it not true that though the code is incorrect, referencing an object of > class X using a reference of subclass Y, it will fail only at runtime and not > at compile time? >
posted 15 years ago
The code will not compile. the rules roundup game is correct. Try it for yourself.