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 we write a constructor for a Servlet class ? if yes how ?
if no why not ?

Answer Posted / tharun raj

yes, we can provide a constructor in servlet calss..
Webcontainer uses the similar code shown below for creating
servlet object for our servlet class

Class c=Class.forName("OurServlet");
Object o=c.newInstance();

this newInstance() method uses zero argument constructor
while creating object..

Is This Answer Correct ?    10 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain url encoding?

987


What is servlet collaboration?

1141


What are the types of servlets? Explain

1257


What is the directory structure of web application?

979


What is the life cycle of a servlet?

1526


Tell us something about servletconfig interface.

993


What do you mean by singlethreadmodel interface?

1043


How is the get () method different from the post() method?

968


Difference between doget and dopost?

1167


How can you create a session in servlet?

1140


What are the exceptions thrown by servlets? Why?

1166


What is servlet lazy loading?

1162


What is servlet? Explain

1058


What do you mean by the servlet chaining?

1076


Explain servlet events?

1004