Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


can v create a constructor 4 servlet?

Answers were Sorted based on User's Feedback



can v create a constructor 4 servlet?..

Answer / chandra kunchala

yes ofcourse we should.
it is mandatory for servlet.
for servlets we required publc no argument constructor. if v
don't having that one, our servlet should not work, even
though if you are not crating the public no-argument
constructor, the java compiler will take the responsibility
to create public no- argument constructor.. mean while your
servlet should be public otherwise you will get
RuntimeException.


we can create costructor for sevelet but it should b no-
argument constructor. and u r servlet should be public.
and one more thing this constructor in not in the place of
init() method..

Is This Answer Correct ?    7 Yes 0 No

can v create a constructor 4 servlet?..

Answer / vijayalakshmi

yes, we can create constructor 4 a servlet,but its is
optional, because the compiler bydefault creates constructor
4servlet.

Is This Answer Correct ?    7 Yes 1 No

can v create a constructor 4 servlet?..

Answer / reddy akhi

sure why not if we are not provide a constuctor for servlet
it automatically get constructor by the java compiler if we
provide a constuctor for a servlet the java compiler will
not provide constuctor at that situation

Is This Answer Correct ?    7 Yes 2 No

can v create a constructor 4 servlet?..

Answer / sanjay sah

Yes, we can create constructor for servlet but that one
should be public no-args constructor.
If we do not create then compiler itself takes care for
it.Servlet container creates instance of servlet by invoking
public no-agrs constructor.

Is This Answer Correct ?    5 Yes 0 No

can v create a constructor 4 servlet?..

Answer / paidi

Yes, It can possible to create the constructor inside the
servlet , it wont give any exception or error for creation
and it compile properly. But, Servlet initialization will
done by container. Container calls the init() to
initialize the servletconfg obj. No Use to write the
constructor inside the servlet.

Is This Answer Correct ?    2 Yes 0 No

can v create a constructor 4 servlet?..

Answer / rajesh r

Yes we can obiviously create a contructor for SERVLETS

But it is toooo early to play with request or reponse
objects or any information regarding Context or Config
since these are not at all created if you put these in
constuctors..

Regards
Rajesh R
Rajeshr1988@gmail.com

Is This Answer Correct ?    1 Yes 0 No

can v create a constructor 4 servlet?..

Answer / ravindra nhavi

yes we can create constructor of servlet instead of init
method but i dont get servlet specification answers.

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More Servlets Interview Questions

What are the new features added to servlet 2.5?

0 Answers  


In jsp custom tags from child tags to how many levels of parent tags you can acess

1 Answers   Bosch,


What are the two important api's in for servlets?

0 Answers  


Difference between get and post in java servlets?

0 Answers  


How are Sessions are more advantage than using of Cookies or URLReWriting?

2 Answers   CTS,


how the jsp page can be regenerated?

2 Answers   HCL,


What is servlet container?

0 Answers  


can anybody send me j2ee softwares such as tomcat,weblogic server ,netbeans

2 Answers  


What is the difference between Servlets and Applets?

0 Answers  


What is war file?

0 Answers  


What type of protocols are used in HttpServlet?

3 Answers  


Hi friends am newbie to servlet. How code reusability easy in servlet. why not in jsp . here reusabillity means only javabeans or any thing else.

1 Answers  


Categories