Computer Science, asked by madhumishra45, 6 months ago

1. How constructor can be used for a servlet?
a) Initialization
b) Constructor function
c) Initialization and Constructor function
d) Setup() method​

Answers

Answered by swapan2117mondal
2

Answer:

(A) is the answer INITIALIZATION

Answered by adventureisland
0

Option (C) is correct.

Using the "Initialization and Constructor function" we can be used for a servlet.

About Constructor Vs Servlet :

  • Although constructors are permitted in Servlet methodologies, they should initialize the Servlet using the init() method for two main reasons: first, constructors cannot be expressed on an interface for Java, and secondly, constructors cannot be defined on an interface in Java.
  • In Java, interface constructors can indeed be defined. Any class that respects the Servlet interface is therefore exempt. In addition, Servlet needs the container's ServletConfig object for initialization.

Similar questions