No.. Because Web-container creates object of our servlet class using zero argument constructor. If servlet class contains only parameterized constructor the java compiler does not generate zero argument constructor so web-container fails to create an object of servlet class. So a programmer must make sure that the servlet class is going to contain zero argument constructor explicitly or implicitly. Because web-container uses zero argument constructor to create object of a servlet.
Note: When java class is not having any constructor the compiler automatically generates zero argument constructor. If java class is having user-defined constructors the compiler does not generate the default zero argument constructor.
No comments:
Post a Comment