Question:
Given the following snipped from the DD, which of the following lines
would cause a compile-time or runtime-error?
<context-param>
<param-name>maximumOrders</param-name>
<param-value>8</param-value>
</context-param>
public class TestServlet extends HttpServlet { //1
public void doGet(HttpServletRequest req, HttpServletResponse res)
//2
throws IOException, ServletException { //3
String max =
getServletContext().getInitParameter("maximumOrders"); // 4
int max = Integer.parseInt(max); // 5
int max2 = (int)
getServletContext().getInitParameter("maximumOrders"); // 6
Integer max2 = (Integer)
getServletContext().getInitParameter("maximumOrders"); // 7
}
}
|