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 trial

Java Java Objects (Retired) Creating the MVP Strings and Chars

Method, Constructor? etc

I do not understand the dfference between these and why the need for both. it seems like a lot of extra work.

1 Answer

Hi Ronald - A constructor is a special type of method that's used to create a new instance of an object. It actually helps save some work, because it lets you assign values to the instance's member variables as part of creating the object - otherwise, you'd have to create an instance of an object and assign values to it separately. The benefit of this might not be clear when you're first starting out but it'll make a lot more sense when you see more examples of it in use!