"For example, a Dog "IS A" Animal, so you don't need to cast it. But an Animal may not always be a Dog. So you need to cast it to make it compile and during the runtime the actual object referenced by animal should be a Dog otherwise it will throw a ClassCastException."
Reading this I was expecting to see ClassCastException...
I really really appreciate your wonderful explanation! Thank you!
About Question enthuware.ocajp.i.v7.2.951 :
Moderator: admin
-
- Posts: 10
- Joined: Wed May 09, 2018 12:48 pm
- Contact:
Who is online
Users browsing this forum: mcpunjabi and 44 guests