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 / chandra

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 ?    9 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is servlet name in web xml?

955


What are the life-cycle methods for a servlet?

948


What is the purpose of requestdispatcher interface?

1009


What’s the difference between sendredirect and forward methods

1021


What is servlet and its advantages?

1003


What is the purpose of dispatcherservlet properties?

1027


Is that servlet is pure java object or not?

1048


What do you mean by session tracking and also explain its techniques?

913


What are the difference between RMI and Servlets?

1524


Why don't we write a constructor in a servlet?

1000


What is meant by session? Tell me something about httpsession class?

966


What are different Authentication options available in Servlets.

1015


What is the use of attribute in servlets?

1007


What is http servlet in java?

1019


What is called Session Tracking?

1121