What will happen inside init() in servlet. my interviewer
asked servlet lifecycle. i said "once servlet is loaded in
to memory init() will be called which performs servlet
initialization " . Again interview asked what values will be
initialized . what is difference between init() and
init(ServletConfig config).
Answer Posted / manidhar
Your superclass includes two versions of init(),one that
takes a ServletConfig and a convenience version thats no -
arg. The3 inherited init(ServletConfig) method calls the no-
arg init method, so the only one u need to override is the
no-arg version.
no law that stops u from overriding the one that takes a
ServletConfig,but if u do then u better call super.init
(ServletConfig) but theres really NO reason why u need to
override the init(SC) method, since u can always get ur
ServletConfig by calling inherited getServletConfig()
method.
correct me if am wrong
| Is This Answer Correct ? | 3 Yes | 3 No |
Post New Answer View All Answers
What is difference between printf and scanf?
What is consumer interface?
Define nashorn in java8.
What is generic class?
What is java developer skills?
23. Storage space in java is of the form Stack Queue Heap List 24. What is java code embedded in a web page known as Applets Servlets scriptlets snippets 25. Which of the following attributes are compulsory with an
What is meant by 'Class access modifiers'?
Which software is used for java programming?
Explain Basics of OOP Language in java
What is the use of parseint in java?
Which package is imported by default?
What are local variables?
what is the difference between preemptive scheduling and time slicing? : Java thread
What do you know about java?
What is jee6?