This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
This issue does not look me like of RAD region being I executed the code using the command line/eclipse in java 5 and I also got the class cast exception at run time.
I guess, the root cause is something else. Can it be running in some of our friends machine just because they have java 6 rather than java5. Btw if you tweak the code a bit number to integer casting works fine. The below code works fine
The code given above will compiles but throws runtime exception but if you remove comment on line number 5 then the above code will compiles and runs fine.
after line number 5 actual super class reference refer to sub class object so casting to Integer successfull at runtime but when super class reference refer to object of itself (that is commenting line number 5) then casting at line number 6 throws exception at runtime.