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
2
Answer:
(A) is the answer INITIALIZATION
Answered by
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
Biology,
3 months ago
Biology,
3 months ago
Political Science,
6 months ago
India Languages,
6 months ago
Biology,
10 months ago
Physics,
10 months ago