Can I get ClassCastException when program is running using operator as, at the same time program should be compiled correctly. Maybe there is some trick with types.
For example with simple type inheritance
((Animal) -> Unit) --> ((Cat) -> Unit)
Can I get ClassCastException when program is running using operator as, at the same time program should be compiled correctly. Maybe there is some trick with types.
For example with simple type inheritance
((Animal) -> Unit) --> ((Cat) -> Unit)
Copyright © 2021 Jogjafile Inc.
Both
(Animal) -> Unitand(Cat) -> Unittypes are represented by the same classFunction1<P1, R>. Casting one to another will never result in aClassCastExceptionsince they are the same at runtime.