Child obj3 = (Child) new Base(); //we need to cast here
This is not a good thing to do.
Lets say you have a method defined in a sub class (not present in the super class), this this case.
calling obj3.childMethod() will result in
java.lang.UnsupportedOperationException
This is because the object is actually of type Base, and doesnt have the method 'childMethod'.
So up casting is fine,
Before down casting, make sure the object passes the 'instance of'
test, else you might end up with UnsupportedOperationException.
Cheers, Joy [SCJP 1.4, SCBCD 5.0]
get high on alcohol, algorithm or both