Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2006

Tip: Looking for answers? Try searching our database.

Need of default constructor

Thread view: 
arvind - 05 Sep 2006 12:34 GMT
hi,
i am new to java beans.
why is it necessary to use the default counstructor for a bean which
contains no parameters?
bharat - 05 Sep 2006 12:43 GMT
Becoz bean uses interospection to deside members of the class so it
need no argument constructor.
> hi,
> i am new to java beans.
> why is it necessary to use the default counstructor for a bean which
> contains no parameters?
Thomas Hawtin - 05 Sep 2006 14:18 GMT
> i am new to java beans.
> why is it necessary to use the default counstructor for a bean which
> contains no parameters?

The no-args constructor allows tools or libraries to construct a bean of
a given class. There's not much point fiddling with the properties and
events of a bean if you can't construct it in the first place.

(Point of pedantry: "Default constructor" with this meaning is a C++
term. In Java a default constructor is just the synthetic constructor
provided by the compiler if no others are present.)

Tom Hawtin
Signature

Unemployed English Java programmer
http://jroller.com/page/tackline/

arvind - 05 Sep 2006 15:33 GMT
Thanks for the reply Thomas.

> > i am new to java beans.
> > why is it necessary to use the default counstructor for a bean which
[quoted text clipped - 12 lines]
> Unemployed English Java programmer
> http://jroller.com/page/tackline/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.