Given following classes:
 
class A { int x; } 

class B : A { int y; } 
Which code fragments will compile and run successfully?
Explanation
Object a = new A();
Object b = (B)a;
will compile successfully as well, but throw an exception at runtime

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты