what is the use of constructors in java when we can intialize objects directly
tinamary 27 Newbie Poster
Recommended Answers
Jump to PostCan you elaborate a little more on the question? All object creation is done through constructors. If no constructor is specified, the compiler will supply a default empty constructor that basically does nothing. If you wish to provide info that initializes some values in the object when it's created, you …
Jump to PostDo you think that user of your application will be interested in reading your code and seting all variables by him self? Or do you think all variables are always initialized?
All 8 Replies
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster
Pavie 0 Newbie Poster
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster
java_programmer 0 Junior Poster
new_programmer 0 Junior Poster in Training
Lourdupinto 0 Newbie Poster
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.