ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Java J2EE  >>  Java Related  >>  Servlets
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
Can we write a constructor for a Servlet class ? if yes how ?
if no why not ?
 Question Submitted By :: Suryakanth
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Can we write a constructor for a Servlet class ? if yes how ? if no why not ?
Answer
# 1
you can write as like for regular class.
 
Is This Answer Correct ?    2 Yes 2 No
Abc
 
  Re: Can we write a constructor for a Servlet class ? if yes how ? if no why not ?
Answer
# 2
No..not at all,,,,servlet is a class which is dynamically 
loaded...dynamically loaded class never requires 
constructors.
 
Is This Answer Correct ?    3 Yes 4 No
Ravi
 
 
 
  Re: Can we write a constructor for a Servlet class ? if yes how ? if no why not ?
Answer
# 3
constructor required, but it should be public no-argument
constructor. even though if you are not write that
constructor   java compiler will create that construtctor by
default. for that your servlet class should be public other
wise you will get RuntimeWxception saying RequestedResource
is not available  like that.
 
Is This Answer Correct ?    2 Yes 2 No
Chandra
 
  Re: Can we write a constructor for a Servlet class ? if yes how ? if no why not ?
Answer
# 4
yes offcourse you can write a constructor for a servlet
after all it is a java class. you can simply provide but if
u do not provide then it is by default include the no
argument constructor that is used by the Init() method in
the servlet life cycle.
 
Is This Answer Correct ?    3 Yes 0 No
Abhishek Taneja
 
  Re: Can we write a constructor for a Servlet class ? if yes how ? if no why not ?
Answer
# 5
yes, we can write constructor on our own but it should be 
no argument public constructor only, cause container will 
create the object so it needs no argument constructor.
 
Is This Answer Correct ?    6 Yes 0 No
Sekhar Babu
 
  Re: Can we write a constructor for a Servlet class ? if yes how ? if no why not ?
Answer
# 6
yes., when ever the servlet is executed .,it requires 
configuration.,the configuration should be done in init() 
method only.,
 
Is This Answer Correct ?    1 Yes 0 No
N.l.narayana
 

 
 
 
Other Servlets Interview Questions
 
  Question Asked @ Answers
 
How to deal with multi-valued parameters in a servlet?  2
What is connection pooling? Wipro3
How do you track a user session in servlets?  2
What happens, when client requests for server object, which is not yet loaded into the memory?  1
Life Cycle of servlets?  4
How to maintain security in servlets?  2
Can we use javascript in Servlets? Wipro1
1.HttpSession 2.Hidden fields 3.URL Rewriting these primitive type of Session maintainance. What is the other type of process that could help to maintain the Session? pls Explain the process if u know? OnMobile3
where the generated jsp source file are stored? HCL4
How to work with Chinese login page (internationalization).if he enters user name and password in chinese, how is it converted to English and validate in db? And in reverse it should display welcome message in Chinese,if user is valid Bosch3
How do you create connections for number of users, if you want to improve performance?  1
Difference between Include, Forward and sendRedirect in Servlet? AZTEC3
How two servlets communicate with each other?  1
If we disable cookies in our web page, what will happen? Zensar5
Is it possible to send a mail from a servlet? Explain?  1
What methods do we use in Servlet to Applet communication?  1
how a servlet is instantiated, whether the container calls init() or by calling any other method? please somebody reply.. Siemens2
What is use of parseQueryString ?  1
How to invoke a Servlet? Mastek2
what is session tracking?what are types of session tracking ?and when to cookies,when to use sessionmanagement,whent use url rewriting technique,plz explain briefly? Satyam2
 
For more Servlets Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com