File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes overloading constructor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "overloading constructor" Watch "overloading constructor" New topic
Author

overloading constructor

sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1222
what happen if we write constructor in servlet?
I mean if there isn't no argument constructor?
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874


Aruna,

I mean if there isn't no argument constructor?


All servlet containers require a default no-argument constructor to create a instance, otherwise your servlet would fail.
Shiraz Khan
Ranch Hand

Joined: Mar 20, 2006
Posts: 51
According to my understanding this no-argument constructor is provided by Compiler just like any other class. Even if you write a no-argument constructor, there should not be any problem.
Please correct me if I am wrong.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61598
    
  67

Shiraz Khan wrote:Please correct me if I am wrong.
You are wrong.

When you provide your own non-nullary constructor, no default nullary constructor is provided. Therefore, the servlet will fail.

Constructors are not useful notions when it cones to servlets.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
Don't get me started about those stupid light bulbs.
 
subject: overloading constructor