Multiple choice technology

Can we write a constructor for servlet?

  1. Yes, but always call the default constructor.

  2. No, no need to call the default constructor.

  3. yes, always.

  4. no, always.

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

You CAN write a constructor for a Servlet, but the servlet container (not your code) calls the no-argument constructor during instantiation via reflection. If you write a parameterized constructor, it won't be used. The option 'Yes, but always call the default constructor' is misleading - the container calls it, not your code. Option A is technically correct but poorly phrased.