Header Ads

  • Breaking Now

    Why there are no constructors in servlets?

    A servlet is just like an applet in the respect that it has an init() method that acts as a constrcutor. Since the servlet environment takes care of instantiating the servlet, an explicit constructor is not needed. Any initialization code you need to run should be placed in the init() method since it gets called when the servlet is first loaded by the servlet container.

    Post Top Ad

    Post Bottom Ad