Register now or log in to join your professional community.
no , we cannot provide a parameterized constructor in servlet.As , in servlet consist of the container creates the object for servlet.
No.Servlet instances created by Servlet container, it Create no argument constractor.
No, in servlet every instance is created by the given container via reflection api.
No, Servlet instances are created by the container, and they expect to find a public, no-arg constructor (the default constructor).
no! we cannot provide a parameterized constructor in servlet.The servlet container creates the object for sevrlet.The container will create the object based on Class.forName(String classname). we can create an object to a class using Class.forName(), if the class contains default constructor only.since the container uses the Class.forName() code in creating object, we do not write parameterized constructor as part out servlet. Even though if we want to write parameterized constructor, we have call the constructor from service()method!
yes we keep parameterised constructor in our servlet class.
No we can't use paramererized constructor