How it is possible to create object for HttpServletRequest Interface?
HttpServletRequest is an interface, but still servlet container can create object of the same. How? Why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The servlet container has a class implementing this interface, and instantiates an object of this class. Just like when you do
Listis an interface, and you instantiateArrayList, which is a class implementingList.The servlet container does something like the following:
This is the basis of OO and polymorphism.