I can understand what upcasting is but Downcasting is a little confusing. My question is why should we downcast? Can you help me with a real time example ? Is downcasting th
To access the header methods of of the ServletResponse in a filter, you have to downcast to to an HttpServletResponse.
It's good to declare objects by the class they extend, so you can change the implementation on the fly. However if you need to access any of the methods that are specific to the implementation, you need to downcast.