Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJoão Elvas
5,400 PointsWhy don't use a class constructor to build objects?
I'am a computer science student and i know a lot of java by now, why don't we use Java constructers to build the objects it would be better to pass all those values at once right?
Taylor Bryant
7,395 PointsTaylor Bryant
7,395 PointsThat is a viable option for this and can be used if you please. The reason they do not use a constructor is that using one can get confusing on the order of the values that need to be passed. Its easier to let the IDE tell you which setter methods an object has and you to set them than it is to check the constructor for the exact order it takes values.