A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Elasticsearch in Action
this week in the
Why do we use Constructors in Java ?
Joined: Aug 30, 2009
Aug 31, 2010 07:02:12
Why do we use Constructors in
? What is the purpose of it?
Vinod Kumar Nair
"Any fool can write code that a computer can understan. Good programmers write code that humans can understand."
author and iconoclast
Joined: Jul 08, 2003
Aug 31, 2010 07:04:33
To construct objects? Their purpose seems pretty self-evident: when you create an object, there's obviously a need to initialize the data in that object to a particular known good state. That's what constructors are for.
[Jess in Action]
Joined: Apr 14, 2004
Aug 31, 2010 07:04:51
To ensure everything the object needs is initialized at construction time.
[Damn your quick typing Ernest!]
I agree. Here's the link:
subject: Why do we use Constructors in Java ?
constructors in jpa Entity Class
what is need of private constructors in java
Diff btwn beans and ordinary object
constructors for Enum types....
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015