Multiple choice technology programming languages

Can we use the constructor, instead of init(), to initialize servlet?

  1. Yes

  2. No

  3. May Be

  4. Can't Say

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

Technically yes, you can use a constructor for servlet initialization. However, the servlet specification recommends using init() because: (1) ServletConfig is not available in the constructor, (2) init() is called after the container completes initialization. Using constructor is possible but not standard practice.