This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
The first Building gets printed out in the Terrace constructor, which relies on base class Building's constructor.
The second Building gets printed out in the constructor for b.
Next, the compiler takes this new Buliding and tries to convert it to a House as part of the cast attempt. That fails, because b's run time dynamic type is Building, which cannot be cast to the more specific type House.
By contrast, House b = (House) new Terrace();
would work, because in that case b's runtime type is Terrace, so the cast would be to a more generic type.