This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Great question. While reading this chapter, I went right past this example, looked at the next page which had both type and class as Employee and figured, it shouldn't be possible with polymorphism. however your question made me take notice. I tried this out and it infact works.
This is code which tomcat generated for the jsp ( i removed the package names from the generated source for clarity...both Employee and Person were in packages )
[ October 18, 2005: Message edited by: M Rama ] [ October 18, 2005: Message edited by: M Rama ]
Joined: Feb 14, 2005
First of all Thanks for your great response....
Thanks Rama your answer is clear to me tomcat is typecasting it, that was the code generated by the tomcat now two questions are striking me right here...
1. Will the other servers take care of it..... 2. What are the cases in which tomcat or other server will do automatic typecasting.....
If all the servers are taking care of it, then no need toremember the polymorphism.