Difference between Constructor vs Init method in Servlet? Interview Question Answer

Can we have a Constructor in Java Servlet? or Why do we need a constructor in Servlet if there is already an init() method for initializing Servlet, or what is the difference between the init() method and constructor in Servlet are a couple of questions I have seen in various Java web developer interviews. All of these questions are related to the role of the constructor and init() method in the Servlet implementation class. Though I had shared few thoughts on this, when I wrote the top 10 Servlet questions for Java programmers,  I thought to cover it in more detail here.

تعليقات

المشاركات الشائعة من هذه المدونة

10 points about Java Heap Space or Java Heap Memory

How HashMap works in Java

10 examples of displaytag in JSP, Struts and Spring