Can we define constructors in Servlet?
Answer Posted / vivekanand prasad
The init() method creates and loads the servlet.But the servlet instance is first created through the constructor (done by Servlet container). We cannot write constructors of a servlet class with arguments in servlet (It will throw Exception). So, They provided a init() method that accepts an ServletConfig object as an argument.ServletConfig object supplies a servlet with information about its initialization (init) parameters.Servlet class cannot declare a constructor with ServletConfig object as a argument and cannot access ServletConfig object.
| Is This Answer Correct ? | 20 Yes | 3 No |
Post New Answer View All Answers
Difference between DurableSubscription and non- DurableSubscription?
How primary key is implemented in Oracle?
To what value is a variable of the string type automatically initialized?
What is synchronization and why is it important?
whats is mean by connectionpooling
Explain the different types of memory used by jvm?
Should synchronization primitives be used on bean methods?
How are the elements of a borderlayout organized?
Name the class that is used to bind the server object with RMI Registry?
Which characters may be used as the second character of an identifier, but not as the first character of an identifier?
What modifiers may be used with an interface declaration?
What is the relationship between the canvas class and the graphics class?
If your ui seems to freeze periodically, what might be a likely reason?
What is the purpose of the notifyall() method?
What is glasgow?