How to prevent the ClassCastExceptions?
(a) By using instanceof
(b) By using is-a check
(c) By using arrow operator with check function
(d) By checking type of conversion
I have been asked this question during an interview.
The above asked question is from Downcasting topic in portion Default Arguments vs Overloading, Upcasting and Downcasting of Object Oriented Programming