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

Which protocol will be used by browser and servlet to communicate

989


Why do we have servlet listeners?

1024


Is java servlet still used?

994


What is the directory structure of a war file?

1111


What is the life-cycle of servlets?

1089


List the Different types of servlet?

983


How do you invoke a servelt?

1062


Can we get PrintWriter and ServletOutputStream both in a servlet?

1101


Why the container loads server at the application startup and how?

1009


Can we override destroy method in servlet?

937


How do we share data using 'getservletcontext ()?

976


What is the process to implement doget and dopost methods?

929


What do you mean by servlet context?

1058


What is servlet and its types?

1001


What are different Authentication options available in Servlets.

1009