1.

How constructor can be used for a servlet?(a) Initialization(b) Constructor function(c) Initialization and Constructor function(d) Setup() methodI have been asked this question in an online quiz.I would like to ask this question from Servlet topic in portion Java Server Technologies & Servlet of Java

Answer»

Correct answer is (c) Initialization and CONSTRUCTOR function

Easy explanation: We cannot declare constructors for interface in Java. This means we cannot ENFORCE this REQUIREMENT to any CLASS which implements Servlet interface.

Also, Servlet requires ServletConfig object for initialization which is created by container.



Discussion

No Comment Found

Related InterviewSolutions