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.
Which of the following statements are true?
Choose at least one answer.
A. Every (non distributed) web application has only one instance of ServletContext Correct
B. Every instance of HttpServlet has only one instance of ServletContext Incorrect
C. The ServletContext object is retrieved via the getServletContext method of ServletConfig Correct
D. The ServletConfig object is retrieved via the getServletConfig method of ServletContext Incorrect
my question is why is option 2 is wrong.(It is from examulator.com)
Could it be the question is badly worded?
"Every instance of HttpServlet has only one instance of ServletContext" could be read as
a) Every single instance points to one and only one instance of a ServletContext object (i.e. they don't contain a map of them, just a reference to one, which would be true)
b) Every single instance points to the exact same ServletContext (which would be false for distributed applications).