Yes you can downcast but you may get a ClassCastException at runtime if the Object is not of the correct subtype. To avoid this you can use the instanceof operator.
if(obj instanceof Child) {
...
Type: Posts; User: Junky
Yes you can downcast but you may get a ClassCastException at runtime if the Object is not of the correct subtype. To avoid this you can use the instanceof operator.
if(obj instanceof Child) {
...