C Books Guide and List
C++ Books Guide and List
Best Java Books

3,749 questions

4,049 answers


10,705 users

can we write a parameterized constructor in servlet class or not?

0 votes
asked by john Guru (27,140 points)

1 Answer

0 votes
A web container creates a servlet class  object by calling the newInstance() method .
NewInstance() method checks for the fallowing 
a)A class is public or not
b)A class contain default constructor not.
If we write only parameterized constructer in a servlet then it does’t contain a default constructor then the program will not be executed.
If we write a parameterized constructor and default constructor then servlet is valid  and it’s object is created by the web container by calling the newInstance() 
answered by sara Guru (24,570 points)

Related questions

0 votes
1 answer 35 views
35 views asked by smith Geek (15,340 points)
0 votes
1 answer 5 views
0 votes
1 answer 15 views
15 views asked by keem Expert (13,240 points)
0 votes
1 answer 32 views