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.
Servlets are controlled by the container. The container handles creating request and response objects. The container creates a thread for each request and calls the service method; passing request and response objects as arguments. Go to Sun's site and read about the servlet life cycle. If you have questions on passing objects to methods, please google it.
To say this differently, the container created a response object which implements the HttpServletResponse interface. All your code has to know is how to call the methods described by the interface. You don't need to know anything about how the container actually implemented them.
this is just like the servlet, when the containner startup, it can create the servlet instance, than run the HttpServlet service method, it didn't know what the implements is.Just run the interface methods...