Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
As per the above example Cat and Dog have no relation ship and both belong to Animal category so RuntimeException occurs ( Cat ca = (Cat)a1 because your trying to assign dog object to cat (Since Animal pointing to Dog) and another point is that you can't assign a super class object to a sub class even thought you type cast it.
for Ex: Animal a1 = new Animal(); Cat ca = (Cat)a1;
As per the above example Cat and Dog have no relation ship and both belong to Animal category so RuntimeException occurs ( Cat ca = (Cat)a1 because your trying to assign dog object to cat (Since Animal pointing to Dog) and another point is that you can't assign a super class object to a sub class even thought you type cast it.
for Ex: Animal a1 = new Animal(); Cat ca = (Cat)a1;
As per the above example Cat and Dog have no relation ship and both belong to Animal category so RuntimeException occurs ( Cat ca = (Cat)a1 because your trying to assign dog object to cat (Since Animal pointing to Dog) and another point is that you can't assign a super class object to a sub class even thought you type cast it.
for Ex: Animal a1 = new Animal(); Cat ca = (Cat)a1;