Multiple choice technology architecture

In the init(ServletConfig) method of Servlet life cycle, what method can be used to access the ServletConfig object ?

  1. getServletInfo()

  2. getInitParameters()

  3. getServletConfig()

  4. None

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In the init(ServletConfig) method, the ServletConfig object is passed as a parameter and can be accessed directly. The getServletConfig() method returns this stored config object, which is useful in other methods throughout the servlet lifecycle. getServletInfo() returns servlet information (not config), and getInitParameters() is not a standard method.