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 Data Structures Getting There Class Review

Reason behind the whole video ?

My question is :

What's the reason behind creating constructor and then passing arguments in the treet instantiation and getting the same output as before i.e. This is a new treet ?

We were getting the same output before also.. right ?

Then why changes in the code.. to explain the date concept ?

1 Answer

Nelson Fleig
Nelson Fleig
23,674 Points

The difference is that now you have an object representation of a Treet with defined properties. You are right that there is currently no difference in the String representation of the object. In the upcoming vidoes, you learn about the toString() method, which allows you to define how an object is represented as a String in order to display the properties that we have passed in the constructor (author, description and creationDate). Watch the next videos and hopefully this will clear up.