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 - Retired Getting There Object Inheritance

Jeff Wereb
Jeff Wereb
2,883 Points

What method are we overriding?

Can someone please explain what method we are overriding? It looks to me we are overriding Treet. How does this work?

João Albuquerque
João Albuquerque
1,642 Points

In fact we are overriding the .toString () method, which is available in any class created in java. As the .equals () method etc.

We are overriding the toString() method - an object has a String representation. We use the toString() method to override that String representation from that object class. That way we can customized how the String representation is shown from our class. Keep in mind that he toString() is a subclass of the Object Class.